Solved

how can i set the src property of iframe using javascirpt

Posted on 2007-03-19
5
1,209 Views
Last Modified: 2008-01-09
I have asp.net 1.1 web form and in that i am using Iframe
now i want to set src property of Iframe using javascript
so wht i want is when user clicks on a button then i want to call this javascript function which i will set src property of the page and then user can see the page in iframe
so how can i set the src property of iframe using javascirpt
0
Comment
Question by:ziorrinfotech
5 Comments
 
LVL 17

Expert Comment

by:HuyBD
ID: 18754097
try

parent.nameofiframe.window.location.href="";

HuyBD;
0
 

Author Comment

by:ziorrinfotech
ID: 18754165
hi HuyBD
it does not work
0
 
LVL 30

Accepted Solution

by:
third earned 50 total points
ID: 18754214
try,

<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">
<iframe name="myframe" src="" width="100%" height=""></iframe>
<form name="frm1" method="post" action="" onsubmit="return ">
<input type="text" name="txt1" value="http://www.google.com">
<input type="button" value="Go" onclick="document.frames['myframe'].location=this.form.txt1.value;">
</form>
</body>
</html>
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 18754576
window.frames, third...
0
 
LVL 30

Expert Comment

by:third
ID: 18754721
yes, you are right. why did I do that? ;-) getting rusty everytime I handle another language...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now