/    Sign up×
Community /Pin to ProfileBookmark

Script not working?

I am trying to get the following script to work on my site however I would like to have the Javascript part or even the whole script to be put into a .js file. However when I tried to do so half of my page got cut off and just got a bunch of errors. What may be the problem?
Thanks.

[code=php]<a href=”/index.html”>Home</a> | <a href=”/C/index.html” onMouseover=”showit(0)”>Example</a><br>

<ilayer width=400 height=32 name=”dep1″ bgColor=”#FFFFFF”>
<layer name=”dep2″ width=400 height=32>
</layer>
</ilayer>
<div id=”describe” style=”background-color:#FFFFFF;width:400px;height:32px” onMouseover=”clear_delayhide()” onMouseout=”resetit(event)”></div>

<script type=”text/javascript” language=”javascript1.2″>
var submenu=new Array()

submenu[0]='<font size=”2″ face=”Verdana”><b><a href=”/1.html”>1</a> | <a href=”2.html”>2</a> | <a href=”3.html”>3</a> | <a href=”4.html”>4</a> | <a href=”5.html”>5</a></b></font>’

var delay_hide=500

var menuobj=document.getElementById? document.getElementById(“describe”) : document.all? document.all.describe : document.layers? document.dep1.document.dep2 : “”

function showit(which){
clear_delayhide()
thecontent=(which==-1)? “” : submenu[which]
if (document.getElementById||document.all)
menuobj.innerHTML=thecontent
else if (document.layers){
menuobj.document.write(thecontent)
menuobj.document.close()
}
}

function resetit(e){
if (document.all&&!menuobj.contains(e.toElement))
delayhide=setTimeout(“showit(-1)”,delay_hide)
else if (document.getElementById&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhide=setTimeout(“showit(-1)”,delay_hide)
}

function clear_delayhide(){
if (window.delayhide)
clearTimeout(delayhide)
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}
</script>[/code]

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@rhsundergroundJan 21.2004 — could you perhaps give a link with the whole page?
Copy linkTweet thisAlerts:
@PittimannJan 21.2004 — Hi!

A reason for your problem might be, that you put the opening an closing script tag in the .js file.

If you do something like that in your htm file:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<title>Untitled</title>

</head>

<body>

<a href="/index.html">Home</a> | <a href="/C/index.html" onMouseover="showit(0)">Example</a><br>

<ilayer width=400 height=32 name="dep1" bgColor="#FFFFFF">

<layer name="dep2" width=400 height=32>

</layer>

</ilayer>

<div id="describe" style="background-color:#FFFFFF;width:400px;height:32px" onMouseover="clear_delayhide()" onMouseout="resetit(event)"></div>

<script type="text/javascript" language="javascript1.2" src="Lupus1647.js">

</script>

</body>

</html>

and put all the script contents (except the script tag) in the external js file and call it (for the above example) Lupus1647.js it should work!

Cheers - Pit
Copy linkTweet thisAlerts:
@Lupine1647authorJan 21.2004 — Thanks for your help. I found out what I was doing wrong. I forgot the closing tag for the script itself and was causing half of the page to be missing.

Thanks again!
×

Success!

Help @Lupine1647 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...