View Full Version : Scripting problem--- multiple scripts-- HELP PLEASE!!

07-02-2003, 01:53 PM
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 =)


<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;


<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];}
<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;

<img src="img/sbilogo.gif" width="125" height="34">
<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"

<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
<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
<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"

<font size="+1" color="black"><u><b>Products</b></u></font>


Mr J
07-02-2003, 03:28 PM
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

07-02-2003, 03:38 PM
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 =)

07-02-2003, 04:19 PM
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:

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.

Mr J
07-02-2003, 07:13 PM
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

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum