
October 1st, 2008, 03:11 PM
|
|
Registered User
|
|
Join Date: May 2008
Posts: 5
Time spent in forums: 1 h 21 m 15 sec
Reputation Power: 0
|
|
|
Variable not defined.
I'm a beginner with javascript and I'm running into this problem:
I'm getting an undefined. Working with an iframe. I have everything wrapped in a function "init()" in my external and I'm calling init between </body> and </html>.
The onclick triggers as it should. But then I'm getting "iframe is undefined" on this line:
Code:
iframe.location.href = "t1.html";
Here's the whole onclick function:
Code:
autousa.onclick = function() {
var iframe;
if (document.frames) {
iframe = document.frames["testimonialsIframe"];
} else {
iframe = window.frames["testimonialsIframe"];
}
iframe.location.href = "t1.html";
}
Obviously window.frames["testimonialsIframe"]; is not defined (that is the one it is using for firefox). I dunno why it's not working.
Helppp
By the way... Here's the HTML:
Code:
<iframe src="tAutoUsa.html" id="testimonialsIframe" name"testimonialsIframe" class="testimonials">
</iframe>
|