Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-02-2003, 01:53 PM   PM User | #1
fbenson
New to the CF scene

 
Join Date: Jul 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
fbenson is an unknown quantity at this point
Unhappy Scripting problem--- multiple scripts-- HELP PLEASE!!

I have been trying to get this to work for a week now! lol...
I have a Tree and a simple roll over that keep on conflicting with one another.

The Tree has what looks like 3 or 4 sripts to itself and then when I add the rolloever...forget about it..only the rolloevers work... here is the code: THanks!!!! I realllllllllllllllllllly appreicate the help =)

-Francecso

<html>
<head>
<link href="tree.css" rel="styleSheet" type="text/css">
<style type="text/css">
<!--

a:hover {
color: #3300FF;
text-decoration: underline;
}
a:active {
color: #000000;
}
a:link {
color: #000066;
}

-->
</style>


<script language="JavaScript" type="text/JavaScript">

<!--

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>
<body background="img/bg1.gif" vlink="000000" onload="dothat("MM_preloadImages('img/k.gif'));dothis(var treeName = "Tree";
new NosTree (treeName, TREE_NODES, TREE_FORMAT))">

<script language="JavaScript" src="tree_nodes.js"></script>
<script language="JavaScript" src="tree_format.js"></script>
<script language="JavaScript" src="nostree.js"></script>
<script language="JavaScript" type="text/JavaScript">


<!---------------------------------------- -->

var treeName = "Tree";
new NosTree (treeName, TREE_NODES, TREE_FORMAT);

//UNCOMMENT 2 lines below to expand first node of tree and redraw it
//NTrees[treeName].Nodes[0].expanded = true;
//NTrees[treeName].draw();
</script>

<img src="img/sbilogo.gif" width="125" height="34">
<br>
<span class="clsNode"><a href="main" onMouseOut="MM_swapImgRestore()"

onMouseOver="MM_swapImage('Image10','','img/k.gif',1)"><img src="img/j.gif" name="Image10" width="14" height="9" border="0"

target="_window2"><b>Home</b></a><br>
<a href="news.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image101','','img/k.gif',1)"><img

src="img/j.gif" name="Image101" width="14" height="9" border="0" id="Image101" target="_window2"><b>News</b></a><br>
<a href="promo.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image102','','img/k.gif',1)"><img

src="img/j.gif" name="Image102" width="14" height="9" border="0" id="Image102" target="_window2"><b>Promotions</b></a><br>
<a href="gallery.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image103','','img/k.gif',1)"><img

src="img/j.gif" name="Image103" width="14" height="9" border="0" id="Image103" target="_window2"><b>User
Gallery</b></a><br>
<a href="schools.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image104','','img/k.gif',1)"><img

src="img/j.gif" name="Image104" width="14" height="9" border="0" id="Image104" target="_window2"><b>Educational</b></a><br>
<a href="dealers.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image105','','img/k.gif',1)"><img

src="img/j.gif" name="Image105" width="14" height="9" border="0" id="Image105" target="_window2"><b>Dealer
Locator</b></a><br>
<a href="job.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image106','','img/k.gif',1)"><img

src="img/j.gif" name="Image106" width="14" height="9" border="0" id="Image106" target="_window2"><b>Employment</b></a><br>
<a href="contact.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image107','','img/k.gif',1)"><img

src="img/j.gif" name="Image107" width="14" height="9" border="0" id="Image107"

target="_window2"><b>Contact</b></a></span><br>
<br>
<font size="+1" color="black"><u><b>Products</b></u></font>




</body>
</html>
fbenson is offline   Reply With Quote
Old 07-02-2003, 03:28 PM   PM User | #2
Mr J
Senior Coder

 
Join Date: Aug 2002
Location: UK
Posts: 2,789
Thanks: 2
Thanked 14 Times in 14 Posts
Mr J is on a distinguished road
It is very likely that a variable is being used in more than one script.

You'll have to look for this and change it
Mr J is offline   Reply With Quote
Old 07-02-2003, 03:38 PM   PM User | #3
fbenson
New to the CF scene

 
Join Date: Jul 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
fbenson is an unknown quantity at this point
---where?

thanks for responding to my question.

I apologize for my ignorance, but I would not even know where to start searching fo rthis. I am not a JavaScript user. I would like to learn more. Perhaps you could point me in the right direction....thanks =)
fbenson is offline   Reply With Quote
Old 07-02-2003, 04:19 PM   PM User | #4
mordred
Senior Coder


 
Join Date: Jun 2002
Location: frankfurt, german banana republic
Posts: 1,848
Thanks: 0
Thanked 0 Times in 0 Posts
mordred is an unknown quantity at this point
Your code in the onload eventhandler is pretty much non-functional. You need to watch out for string quotes and that they're nested correclty (e.g. single quotes inside double quotes) or escape them.
Plus, you can't use the keyword "var" in a parameter to instantiate a new variable.

Try this eventhandler code instead:

Code:
onload="MM_preloadImages('img/k.gif');var treeName = 'Tree'; new NosTree (treeName, TREE_NODES, TREE_FORMAT);"
If that still doesn't work, you have to look inside the Macromedia functions or the code for the tree menu, whoever that was who wrote that.
__________________
De gustibus non est disputandum.
mordred is offline   Reply With Quote
Old 07-02-2003, 07:13 PM   PM User | #5
Mr J
Senior Coder

 
Join Date: Aug 2002
Location: UK
Posts: 2,789
Thanks: 2
Thanked 14 Times in 14 Posts
Mr J is on a distinguished road
You page also uses 3 .js files


<script language="JavaScript" src="tree_nodes.js"></script>
<script language="JavaScript" src="tree_format.js"></script>
<script language="JavaScript" src="nostree.js"></script>


put them and your page in a zip and post them here.

In order to help further we will need to see the coding of these files
Mr J is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:10 AM.


Advertisement
Log in to turn off these ads.