I'm a novice javascripter at best and I'm having a problem that I usually don't have. These problems are usually due to my lack of experience and a simple omission of something.
JS:
Code:
var keith = document.getElementById("keith");
var deborah = document.getElementById("deborah");
var chris = document.getElementById("chris");
keith.onclick = new function() {
var iframe = frames['bios'];
iframe.location.href = "http://www.google.com";
}
HTML:
Code:
<ul class="about">
<li><a href="#" id="keith">Keith Gilleard</a></li>
<li><a href="#" id="deborah">Deborah Gilleard</a></li>
<li><a href="#" id="chris">Chris Watson</a></li>
</ul>
<hr />
<iframe id="bios" name="bios" src="bios.html"></iframe>
Simple, right? Not when you're me.
I'm getting keith has no properties on JS line 5.
As you can see, I'm simply trying to change the frame's source on click.
UPDATE
I just realized that i probaby need to have it say = new function. I added it and that worked out for me. More to come in a moment.
SO
Now I'm getting iframe has no properties on line 7. I realize this is due to the way I've referenced my iframe. I just finished reading something somewhere that said I could reference iframes in that way, and it was better to do so instead of using document.getELementById, but it apparently isn't working.
ACTUALLY
Converting it to referencing by ID still produces the same results (iframe has no properties).
Last edited by soap; 09-29-2008 at 04:04 PM..
|