Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Iframe src Firefox 1

Status
Not open for further replies.

nickdel

Programmer
May 11, 2006
367
GB
Guys, I'm having a bit of a dumb day...

Code:
function GetPrice(ds, cabin){
var guests = document.getElementById('NoGuests').value;
var nights = document.getElementById('NoNights').value;
var iframe = window.frames['GetTotalPrice'];
if(document.getElementById('Dogs')){
var dogs = document.getElementById('Dogs').value;
iframe.location='CalcPrice.asp?cab='+cabin+'&ds='+ds+'&g='+guests+'&n='+nights+'&Dogs='+dogs;
}
else
{
iframe.location='CalcPrice.asp?cab='+cabin+'&ds='+ds+'&g='+guests+'&n='+nights;
		}
		}

Called from a combo onChange event, works fine in IE but not firefox, have tried getElementById('').src but this doesn't work either...

I'm going to kick myself when monksnake replies to this at lightning speeds!! [wink]

Cheers

Nick
 
I hacked up this little test harness:
Code:
<html>
<head>
<style type="text/css">
#wibble {
	border: 1px solid black;
	width: 500px;
	height: 300px;
}
</style>
<script type="text/javascript">
function wibbleFunc() {
	var ifrm = document.getElementById('wibble');
	var params = "test1=" + escape(document.getElementById('test1').value);
	ifrm.[!]src[/!] = 'example.html?' + params;
}
</script>
</head>

<body>
<h1>Test</h1>
<form action="" onsubmit="return false;">
	<input type="text" name="test1" id="test1" value=""/>
	<button onclick="wibbleFunc()">Try</button>
</form>
<iframe src="about:blank" id="wibble"/>
</body>
</html>
This uses .src instead of .location to get to the iframe. It works in both FX and IE for me this way. I also used an ID to target the iframe... this might be more useful for what you want to do.

Cheers,
Jeff


[tt]Jeff's Page [!]@[/!] Code Couch
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top