I'm trying to get this a link to change the ocntent inside an Iframe. The first 2 examples work flawlessly, but when I hit the third and fourth one refresh the whole page and that's what I don't want.
I want it so that ONLY the iframe content changes and not that the whole page refreshes.
Can some see what I did wrong. Here's an online example.
<head>
<script type="text/javascript">
/* Free code from dyn-web.com */
// Two choices for loading new pages into the iframe
// dom0 frames referencing
function loadIframe(iframeName, url) {
if ( window.frames[iframeName] ) {
window.frames[iframeName].location = url;
return false;
}
return true;
}
// assign new url to iframe element's src property
function changeIframeSrc(id, url) {
if (!document.getElementById) return;
var el = document.getElementById(id);
if (el && el.src) {
el.src = url;
return false;
}
return true;
}
</script>
</head>
<body>
<ul>
<li><a href="load1.html" onclick="return changeIframeSrc('ifrm', this.href)">Page 1</a> </li>
<li><a href="load2.html" onclick="return changeIframeSrc('ifrm', this.href)">Page 2</a></li>
<li><a href="http://www.oddsmaker.com" onclick="return changeIframeSrc('ifrm', this.href)">oddsmaker</a></li>
<li><a href="http://www.oddsmaker.com/poker" onclick="return changeIframeSrc('ifrm', this.href)">oddsmaker poker</a></li>
</ul>
</body>
Can anyone see why it's sometimes working fine and other times refeshing the whole page?
Thanks alot,
Brandon

New Topic/Question
Reply



MultiQuote





|