Forum Moderators: open

Message Too Old, No Replies

loading sites within a frame box

using a text box as the url box

         

Andrew Thomas

4:30 pm on Mar 22, 2002 (gmt 0)

10+ Year Member



Sorry me again -

I have a text box and if i type in 'http://www.microsoft.com' i want a small iframe to open up the the microsoft webpage loaded into it.

eg any website that gets types into the text box (on my webpage) loads the appropriate webpage within a box on my website.

hope this is clear

thanks again

Purple Martin

2:05 am on Mar 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Wrap your IFRAME in a hidden positioned DIV like this:

<DIV id="iframeContainer" style="position:absolute; left:100px; top:100px; width:100px; height:100px; visibility:hidden;">
<IFRAME src="blah" border=0 frameborder=0 marginheight=0 marginwidth=0 width="100%" height="100%" name="iframeElement" id="iframeElement" scrolling=none> </IFRAME>
</DIV>

When the user types something in the text box and clicks "Go" or whatever, just use a little bit of JavaScript (document.all and document.getElementById) to set the src attribute of iframeElement to the value of the textbox, and then make the DIV visible. Et voila!

Andrew Thomas

9:34 am on Mar 26, 2002 (gmt 0)

10+ Year Member



>>When the user types something in the text box and clicks "Go" or whatever, just use a little bit of JavaScript (document.all and document.getElementById) to set the src attribute of iframeElement to the value of the textbox, and then make the DIV visible.

thanks for the help, but im a bit stuck on what to do with the javasript?

i have a text box and your code :

<table width="100%" border="1" cellspacing="0" cellpadding="0" bordercolor="#3399FF">
<tr>
<td><DIV id="iframeContainer" style="position:absolute; left:100px; top:100px; width:100px; height:100px; visibility:hidden;">
<IFRAME src="http://www.akhter.com" border=0 frameborder=0 marginheight=0 marginwidth=0 width="100%" height="100%" name="iframeElement" id="iframeElement" scrolling=none> </IFRAME>
</DIV>
</td>
</tr>
</table>
<br>
<input type="text" name="textfield">
</td>
</tr>
</table>

but im getting confused on what to do with the javascript

thanks again