Forum Moderators: open

Message Too Old, No Replies

problem with iframe linking

         

dongastone

9:53 am on Dec 15, 2008 (gmt 0)

10+ Year Member



Hi there,
I have site and i have menu that loads different pages in iframe(in the right side). In menu HISTORY there is only one "clackable" thumbnail (up left)and it opens gallery. I have one button called "BACK TO A52", so i want this button to point to index.html, but with page from "HISTORY" loaded in right iframe.

I will show the code from help that i used:

<script>
function init(){
loc=location.href;
loc=loc.split("?");
if(loc.length>1)
document.getElementById("myframe").src=loc[1];
}
onload=init;
</script>

CODE

<iframe id="myframe" src="about1.html" width="628" height="518" frameborder="0" scrolling="no" name="frame" ></iframe>

this is in index.html

ind this the code of the button
CODE

<a href="index.html?thumb2.html">

[edited by: encyclo at 3:32 pm (utc) on Dec. 15, 2008]
[edit reason] no links to personal sites please, see posting guidelines [/edit]

rocknbil

2:36 pm on Dec 15, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome aboard dongastone!

Try


<script type="text/javascript">
function init(){
loc=location.href;
loc=loc.split("?");
if (document.getElementById('myframe') && (loc.[1] != '')) {
document.getElementById('myframe').src=loc[1];
}
}
window.onload=function() { init(); }
</script>

P.S., kindly review #13 of TOS [webmasterworld.com]

dongastone

3:31 pm on Dec 15, 2008 (gmt 0)

10+ Year Member



I tried and it doesn`t work. Did anybody see that i have two times "on load" and i make like this "<body onload="loadIF();init()">" is it OK?