...

View Full Version : nother noob problem



neonwhiskey
02-20-2003, 07: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

pilla
02-20-2003, 09:18 PM
Your

function drawCombobox(){

have several line breaks:



function drawCombobox(){document.write("<table border=1 cellpadding=3 cellspacing=0 bordercolor=#000000 here
onClick='showhide(1);event.cancelBubble=1'><tr><td><span here
style='cursor:hand'><b>Name</b></span></td></tr></table>")
document.write("<div id='innermenu' here
style='position:relative;left:0;top:0;width:240px; here
height:100px;border:1px solid here
black;background-color:white;overflow-y:scroll;visibility:hidden'>")


which shouldn't be there.
Try again after removing them.
:)

neonwhiskey
02-20-2003, 10:55 PM
hi, those line breaks are just from posting the questions here, and aren't in the original JS file.
~jenn



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum