neonwhiskey
02-20-2003, 06:24 PM
They work when all in one page, but not when I try to make a JS file. Here's my html:
<html>
<head><title>combobox</title>
<script language="javascript" src="combobox.js" type="text/javascript"></script>
</head>
<body>
<script language="javascript">window.onload=drawCombobox;
</script>
</body>
</html>
here's the JS file:
function drawCombobox(){
document.write("<table border=1 cellpadding=3 cellspacing=0 bordercolor=#000000
onClick='showhide(1);event.cancelBubble=1'><tr><td><span
style='cursor:hand'><b>Name</b></span></td></tr></table>")
document.write("<div id='innermenu'
style='position:relative;left:0;top:0;width:240px;height:100px;border:1px solid
black;background-color:white;overflow-y:scroll;visibility:hidden'>")
function addLink(linkname,url){
document.write("<a href='"+url+"'>"+linkname+"</a><br>")
}
function showhide(state){
var cacheobj=document.getElementById("innermenu").style
if (state==0)
cacheobj.visibility="hidden"
else
cacheobj.visibility=cacheobj.visibility=="hidden"?"visible":"hidden"
}
addLink("Any site name","http://www.anysite.com")
addLink("Any site name","http://www.anysite.com")
document.onclick=function(){showhide(0)}
document.write("</div>")
}
please help, 2 days trying to solve.
thx,
Jennifer
<html>
<head><title>combobox</title>
<script language="javascript" src="combobox.js" type="text/javascript"></script>
</head>
<body>
<script language="javascript">window.onload=drawCombobox;
</script>
</body>
</html>
here's the JS file:
function drawCombobox(){
document.write("<table border=1 cellpadding=3 cellspacing=0 bordercolor=#000000
onClick='showhide(1);event.cancelBubble=1'><tr><td><span
style='cursor:hand'><b>Name</b></span></td></tr></table>")
document.write("<div id='innermenu'
style='position:relative;left:0;top:0;width:240px;height:100px;border:1px solid
black;background-color:white;overflow-y:scroll;visibility:hidden'>")
function addLink(linkname,url){
document.write("<a href='"+url+"'>"+linkname+"</a><br>")
}
function showhide(state){
var cacheobj=document.getElementById("innermenu").style
if (state==0)
cacheobj.visibility="hidden"
else
cacheobj.visibility=cacheobj.visibility=="hidden"?"visible":"hidden"
}
addLink("Any site name","http://www.anysite.com")
addLink("Any site name","http://www.anysite.com")
document.onclick=function(){showhide(0)}
document.write("</div>")
}
please help, 2 days trying to solve.
thx,
Jennifer