View Single Post
  #1 (permalink)  
Old Apr 20th, 2008, 15:41
NYCSavage NYCSavage is offline
New Member
Join Date: Apr 2008
Location: Liverpool
Age: 30
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Open html inside Div on mouse click

Hi, I am currenty coding my site and decided it would look good to have a div styled layout.

I have managed to get the 1st part (mouse hover) of my problem to work using this code:

In the head:
Code: Select all
 <script>
<!--

var content=new Array()

content[0]='<br><big><b>OPTION 1</b></big><br>Enter text here'
content[1]='<br><big><b>OPTION 2</b></big><br>Enter text here'

function regenerate(){
window.location.reload()
}
function regenerate2(){
if (document.layers){
appear()
setTimeout("window.onresize=regenerate",530)
}
}

function changetext(whichcontent){

if (document.all||document.getElementById){
cross_el=document.getElementById? document.getElementById("descriptions"):document.all.descriptions
cross_el.innerHTML='<font face="Verdana"><small>'+whichcontent+'<font></small>'
}
else if (document.layers){
document.d1.document.d2.document.write('<font face="Verdana"><small>'+whichcontent+'</small></font>')
document.d1.document.d2.document.close()
}

}

function appear(){
document.d1.visibility='show'
}

window.onload=regenerate2


//-->
</script>
And in the body:
Code: Select all
<div id="scriptmenu" style="line-height:20px"><p>
            <a href="1.html" onMouseover="changetext(content[0])"><small>OPTION 1</small></a><br>
            <a href="2.html" onMouseover="changetext(content[1])"><small>OPTION 2</small></a><br></div>
If you click on Option 1, it loads 1.html in a new window. What I would like is to open 1.html INSIDE a div layer named Box, then if you click OPTION 2, 2.html would open instead in the same div layer.

Hope this makes sense, and can anyone help?
Reply With Quote