PDA

View Full Version : iframe not working in Explorer.


kimberlyhello
04-09-2007, 04:08 AM
Hi,

I have an iframe that loads multiple pages depending on what the user types into a text box. It works fine in firefox, but not in internet explorer(6 and 7)

Here is the javascript code:

window.onload = function () {
if(document.forms["searchbox_006388034472510427843il-s7xg5oy"].q.value.toLowerCase() == "google"){
window.open("http://www.google.com", "site")}

Here is the iframe:

<iframe src="http://www.yahoo.com" width="95%" height="95%" align="top" name="site" id="site"></iframe>


Does anyone see a problem...I don't. Is it a problem with iexplorer? Maybe there is some kind of script I can use for people with browsers other than Firefox.

Thanks in advance to anyone that can help.

I already enabled iframes in my security settings.

rwedge
04-09-2007, 04:42 AM
The window name method works in IE7, FF 2.0 and Opera 9, but you could also use the id of the iframe<script type="text/javascript">
window.onload = function() {
if(document.forms["searchbox_006388034472510427843il-s7xg5oy"].q.value.toLowerCase() == "google"){
// window.open("http://www.google.com", "site");
document.getElementById('site').src = 'http://www.google.com';
}
}
</script>

<iframe src="http://www.yahoo.com" width="95%" height="95%" align="top" name="site" id="site"></iframe>

<form name="searchbox_006388034472510427843il-s7xg5oy" id="searchbox_006388034472510427843il-s7xg5oy" method="post" action="">
<input type="hidden" name="q" id="q" value="google" />
</form>

kimberlyhello
04-09-2007, 07:37 AM
You saved the day.

:thumbsup: