Click to See Complete Forum and Search --> : iFrame Problem


zebdaag
10-13-2005, 10:21 AM
Hi,

I found this on the internet and couldn't get it to work on Firefox can someone help me with this:

PageOne.htm
<html>
<head>
<script language='JavaScript'>

function Search() {
alert(document.frames("PageTwo").document.forms("Members").elements("Search").value);
}

</script>
</head>
<body>
<input type='button' value='Search' onclick='Search();'>
<iframe name='PageTwo' src="PageTwo.htm" width='100%' height='100'>
</body>
</html>


PageTwo.htm
<html>
<body>
<form name='Members'>
<input type='text' name='Search' value='Chris'>
</form>
</body>
</html>

thanks in advance
zeg

Mr J
10-13-2005, 01:44 PM
You were not using square brackets where required and should be window.frames[]

While IE is very forgiving in these matters browers such as Mozilla, Firefox are not


PageOne.htm


<html>
<head>
<script language='JavaScript'>

function Search() {
alert(window.frames["PageTwo"].document.forms["Members"].elements["Search"].value);
}

</script>
</head>
<body>
<input type='button' value='Search' onclick='Search();'>
<iframe name='PageTwo' src="PageTwo.htm" width='100%' height='100'>
</body>
</html>

zebdaag
10-18-2005, 01:56 PM
Thanks for the reply. I tried it and in the first place it worked fine!! I tried it offline running from my harddrive. But when I put it online it doesn't work anymore. I haven't seen that rpoblem before....can someone help me with that??

Thanks in advance
Greetz Zeb

konithomimo
10-18-2005, 02:43 PM
Make sure that "PageTwo.htm" is in the same directory as the page calling it.

zebdaag
10-18-2005, 02:48 PM
This is going to be a problem. Because page2.htm is on a different server...getting data from an extern database?? Is there a solution for this. Is there a way to make this work when two files aren't in the same map.

Greetz Zeb

konithomimo
10-19-2005, 06:09 AM
you have to use the full address for page two then.

src="http://othersite.com/PageTwo.htm"

Mr J
10-19-2005, 08:27 AM
You cannot reference the contents of a page from another domain

zebdaag
10-19-2005, 09:03 AM
why not?? What is the exact problem and isn't there a way to make it work??