![]() |
|
|
#1 (permalink) |
|
Registered User
Join Date: Feb 2004
Posts: 71
|
JS simple prob driving me insane!
Hey, really hope somone can help, I don't know JS i've just hacked it together from various tutorials, all I want is a layer to appear when you mouseover a button and stay open whilst the mouse is on the layer then dissapear when mouse off. This works in IE but nothing in mozilla, whyyyyyyy?????
page concerened [url="http://www.understatedart.co.uk/index8.asp"] HTML Code:
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript"><!-- function show(object) { if (document.layers && document.layers[object] != null) document.layers[object].visibility = 'visible'; else if (document.all) document.all[object].style.visibility = 'visible'; } function hide(object) { if (document.layers && document.layers[object] != null) document.layers[object].visibility = 'hidden'; else if (document.all) document.all[object].style.visibility = 'hidden'; } //--></SCRIPT> whole page, bit messy at the mo still developing it HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <% tID = Request.QueryString("tID") page = Request.QueryString("page") hide = Request.QueryString("hide") if hide = "" then hide = 0 end if if page = "" then page = "img2" end if Dim strConn2, oConn2, oRS2, strSQL2 Dim ID, tID, filename, stitle, sdesc, backtID, imagepath, level tID = Request.QueryString("tID") if tID = "" then tID = 12 end if ID = Request.QueryString("ID") if ID = "" then if tID="1" then ID = "52" else if tID="8" then ID = "1" else if tID="9" then ID = "31" else if tID="6" then ID = "11" else if tID="7" then ID = "28" else if tID="2" then ID = "62" else if tID="12" then ID = "116" else if tID="11" then ID = "72" else if tID="14" then ID = "113" else ID = "6" end if end if end if end if end if end if end if end if end if end if strConn2 = "Driver={Driver do Microsoft Access (*.mdb)}; DBQ=" & Server.MapPath("../db/db9.mdb") Set oConn2 = Server.CreateObject("ADODB.Connection") Set oRS2 = Server.CreateObject("ADODB.RecordSet") strSQL2 = ("SELECT * FROM gallery WHERE ID="&ID) oRS2.Open strSQL2, strConn2 stitle = oRS2("title") sdesc = oRS2("desc") backtID = oRS2("gal") imagepath = oRS2("path") %> <html> <head> <meta http-equiv="content-type" content="text/html;charset=iso-8859-1"> <title>mark hammond photography</title> <META name="description" content="photograhy portfolio of Mark Hammond { photographer }, photo journalistic photography across india & asia and contemporary images. Avalable for freelance."> <META name = "keywords" content="photography, portfolio, mark, hammond, freelance, cornwall, india, asia, photo, contemporary, photographer"> <link href="main.css" rel="stylesheet" type="text/css" media="all"> <style type="text/css" media="screen"><!-- --></style> <SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript"><!-- function show(object) { if (document.layers && document.layers[object] != null) document.layers[object].visibility = 'visible'; else if (document.all) document.all[object].style.visibility = 'visible'; } function hide(object) { if (document.layers && document.layers[object] != null) document.layers[object].visibility = 'hidden'; else if (document.all) document.all[object].style.visibility = 'hidden'; } //--></SCRIPT> <!-- scrollPos = 0 speed=5 scrollMe="" function scrollDown() { clearTimeout(scrollMe) scrollPos +=speed window.frames["frame1_name"].scrollTo(0,scrollPos) scrollMe=setTimeout("scrollDown()",50) if(scrollPos>window.frames["frame1_name"].document.body.scrollHeight - (parseInt(document.getElementById("frame1_id").style.height)-10)){ scrollPos=window.frames["frame1_name"].document.body.scrollHeight - (parseInt(document.getElementById("frame1_id").style.height)-10) clearTimeout(scrollMe) } } function scrollUp() { clearTimeout(scrollMe) scrollPos -=speed window.frames["frame1_name"].scrollTo(0,scrollPos) scrollMe=setTimeout("scrollUp()",50) if(scrollPos<speed){ scrollPos=0 clearTimeout(scrollMe) } } function stopMe(){ clearTimeout(scrollMe) } // --> </script> </head> <body bgcolor="#bbbbbb" onLoad="init();"> <table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%"> <tr> <td align="center" valign="middle"> <table width="61" border="0" cellspacing="0" cellpadding="0" height="0"> <tr height="0"> <td width="0" height="0"> <table width="0" border="0" cellspacing="1" cellpadding="0" height="0"> <tr height="297"> <td valign="top" bgcolor="#bbbbbb" height="297"> <table width="0" border="0" cellspacing="2" cellpadding="0" onMouseover="show('layermen')" onMouseout="hide('layermen')"> <tr> <td onMouseover="show('layermen')" onMouseout="hide('layermen')"> <img src="/images/greyspace.gif" alt="" height="32" width="32" border="0"> <div id="layermen"> <div align="left"> <p class="title"> <a href="#" ><font color="#717171">BOTANICAL ></font></p> <p class="title"> <a href="#" ><font color="#717171">LANDSCAPES ></font></p> <p class="title"> <a href="#" ><font color="#717171">WATERSCAPES ></font></p> <p class="title"> <a href="#" ><font color="#717171">PORTRAITS ></font></p> <p class="title"> <a href="#" ><font color="#717171">ABSTRACT ></font></p> <p class="title"> <a href="#" ><font color="#717171">INIDA ></font></p> <p class="title"> <a href="#"><font color="#717171">ASIA ></font></p> </div> <h6></h6> </div> </td> <td valign="top"> <table width="30" border="0" cellspacing="2" cellpadding="0"> <tr> <td><a href="index.asp"><img src="images/logo.jpg" alt="" width="34" height="94" align="right" border="0"></a></td> </tr> <tr> <td align="right"><img src="images/GALLERIES.gif" alt="" height="84" width="28" border="0"></a></td> </tr> <tr> <td align="right"><img src="images/CONTACT.gif" alt="" height="72" width="28" border="0"></td> </tr> <tr> <td align="right"><img src="images/ABOUT.gif" alt="" height="60" width="28" border="0"></td> </tr> <tr> <td align="right"></td> </tr> </table> </td> </tr> </table> </td> <td bgcolor="white" height="297"> <table width="0%" border="0" cellspacing="1" cellpadding="0" bgcolor="black" height="0"> <tr> <td align="center" valign="top" bgcolor="white"> <div align="center"> <a href="#null" class="highlightit1" onmouseover="scrollUp()" onmousedown="scrollUp(speed=10)" onmouseup="scrollUp(speed=10)" onmouseout="stopMe()"><img src="images/upbut.gif" alt="" border="0"></a> <iframe id="frame1_id" src="gal2.asp?tID=<%=tID%>" name="frame1_name" scrolling="no" align="top" border="0" frameborder="0" height="389" width="123"></iframe> <br> <a href="#null" class="highlightit1" onmouseover="scrollDown()" onmousedown="scrollDown(speed=10)" onmouseup="scrollDown(speed=10)" onmouseout="stopMe()"><img src="images/downbut.gif" alt="" border="0"></a> </div> </td> <td bgcolor="white"> <IFRAME id="T2" SRC="<%=page%>.asp?tID=<%=tID%>&hide=<%=hide%></iframe>" name="T2" scrolling="no" align="top" border="0" marginheight="0" frameborder="0" height="436px" width="592"> </IFRAME> </td> </tr> </table> </td> </tr> </table> </td> </tr> <tr> <td bgcolor="#bbbbbb" width="0"> </td> </tr> </table> </td> </tr> </table> </body> </html> |
|
|
|
|
|
#2 (permalink) |
|
Registered User
Join Date: Feb 2004
Posts: 71
|
found a solution, hope this helps anyone trying to do the same thing
HTML Code:
<script language="JavaScript"><!-- function show(object) { if (document.getElementById && document.getElementById(object) != null) node = document.getElementById(object).style.visibility='visible'; else if (document.layers && document.layers[object] != null) document.layers[object].visibility = 'visible'; else if (document.all) document.all[object].style.visibility = 'visible'; } function hide(object) { if (document.getElementById && document.getElementById(object) != null) node = document.getElementById(object).style.visibility='hidden'; else if (document.layers && document.layers[object] != null) document.layers[object].visibility = 'hidden'; else if (document.all) document.all[object].style.visibility = 'hidden'; } //--></script> <style type="text/css"><!-- .myStyle { position: absolute; visibility: hidden; } //--></style> <a href="javascript:;" onMouseOver="show('myLayer1')" onMouseOut="hide('myLayer1')">a text link</a> <span id="myLayer1" class="myStyle"> <table bgcolor="#ffffcc"><tr><td>This text is initially hidden from view</td></tr></table> </span> |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|