Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The OnClick Events in Dreamweaver's Navigation Bar Script

Status
Not open for further replies.

bentleykf

Programmer
Apr 29, 2002
59
AU
I'm having trouble with dreamweaver's navigation bar scripts. I need to have more than one navigation bar on a page. Maybe I need to use a different script?

This is the dreamweaver javascript between the <head> tags
-----------------------------------------------------------
<script language=&quot;JavaScript&quot;>
<!--
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.indexOf(&quot;#&quot;)!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}
}

function MM_findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document; if((p=n.indexOf(&quot;?&quot;))>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[n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_nbGroup(event, grpName) { //v3.0
var i,img,nbArr,args=MM_nbGroup.arguments;
if (event == &quot;init&quot; && args.length > 2) {
if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
nbArr[nbArr.length] = img;
for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args)) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = args[i+1];
nbArr[nbArr.length] = img;
} }
} else if (event == &quot;over&quot;) {
document.MM_nbOver = nbArr = new Array();
for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args)) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = (img.MM_dn && args[i+2]) ? args[i+2] : args[i+1];
nbArr[nbArr.length] = img;
}
} else if (event == &quot;out&quot; ) {
for (i=0; i < document.MM_nbOver.length; i++) {
img = document.MM_nbOver; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
} else if (event == &quot;down&quot;) {
if ((nbArr = document[grpName]) != null)
for (i=0; i < nbArr.length; i++) { img=nbArr; img.src = img.MM_up; img.MM_dn = 0; }
document[grpName] = nbArr = new Array();
for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args)) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = args[i+1];
nbArr[nbArr.length] = img;
} }
}
//-->
</script>
----------------------------------------------------------

Here is the scripting between the <body> tags
----------------------------------------------------------
<a href=&quot;#&quot;
onClick=&quot;MM_nbGroup('down','group1','main','_images/menubar/menu_main_01c.gif',1)&quot;
onMouseOver=&quot;MM_nbGroup('over','main','_images/menubar/menu_main_01b.gif','_images/menubar/menu_main_01c.gif',1)&quot;
onMouseOut=&quot;MM_nbGroup('out')&quot;>
<img name=&quot;main&quot; src=&quot;_images/menubar/menu_main_01c.gif&quot; border=&quot;0&quot; width=&quot;36&quot; height=&quot;8&quot;
onLoad=&quot;MM_nbGroup('init','group1','main','_images/menubar/menu_main_01a.gif',1)&quot;></a>

<a href=&quot;#&quot;
onClick=&quot;MM_nbGroup('down','group1','newsmsg','_images/menubar/menu_newsmsg_01c.gif',1)&quot;
onMouseOver=&quot;MM_nbGroup('over','newsmsg','_images/menubar/menu_newsmsg_01b.gif','_images/menubar/menu_newsmsg_01c.gif',1)&quot;
onMouseOut=&quot;MM_nbGroup('out')&quot;>
<img name=&quot;newsmsg&quot; src=&quot;_images/menubar/menu_newsmsg_01a.gif&quot; border=&quot;0&quot; onLoad=&quot;&quot; width=&quot;103&quot; height=&quot;8&quot;></a>

<a href=&quot;#&quot;
onClick=&quot;MM_nbGroup('down','group1','intart','_images/menubar/menu_intart_01c.gif',1)&quot;
onMouseOver=&quot;MM_nbGroup('over','intart','_images/menubar/menu_intart_01b.gif','_images/menubar/menu_intart_01c.gif',1)&quot;
onMouseOut=&quot;MM_nbGroup('out')&quot;>
<img name=&quot;intart&quot; src=&quot;_images/menubar/menu_intart_01a.gif&quot; border=&quot;0&quot; onLoad=&quot;&quot; width=&quot;122&quot; height=&quot;8&quot;></a>

<a href=&quot;#&quot;
onClick=&quot;MM_nbGroup('down','group1','photography','_images/menubar/menu_photography_01c.gif',1)&quot;
onMouseOver=&quot;MM_nbGroup('over','photography','_images/menubar/menu_photography_01b.gif','_images/menubar/menu_photography_01c.gif',1)&quot;
onMouseOut=&quot;MM_nbGroup('out')&quot;>
<img name=&quot;photography&quot; src=&quot;_images/menubar/menu_photography_01a.gif&quot; border=&quot;0&quot; onLoad=&quot;&quot; width=&quot;87&quot; height=&quot;8&quot;></a>

<a href=&quot;#&quot;
onClick=&quot;MM_nbGroup('down','group1','downloads','_images/menubar/menu_downloads_01c.gif',1)&quot;
onMouseOver=&quot;MM_nbGroup('over','downloads','_images/menubar/menu_downloads_01b.gif','_images/menubar/menu_downloads_01c.gif',1)&quot;
onMouseOut=&quot;MM_nbGroup('out')&quot;>
<img name=&quot;downloads&quot; src=&quot;_images/menubar/menu_downloads_01a.gif&quot; border=&quot;0&quot; onLoad=&quot;&quot; width=&quot;76&quot; height=&quot;8&quot;></a>

<a href=&quot;#&quot;
onClick=&quot;MM_nbGroup('down','group1','theweb','_images/menubar/menu_theweb_01c.gif',1)&quot;
onMouseOver=&quot;MM_nbGroup('over','theweb','_images/menubar/menu_theweb_01b.gif','_images/menubar/menu_theweb_01c.gif',1)&quot;
onMouseOut=&quot;MM_nbGroup('out')&quot;>
<img name=&quot;theweb&quot; src=&quot;_images/menubar/menu_theweb_01a.gif&quot; border=&quot;0&quot; onLoad=&quot;&quot; width=&quot;56&quot; height=&quot;8&quot;></a>
----------------------------------------------------------
 
You may not think it that helpful, but I'd advise you to make your own...it's not too complex and then you know exactly where the problems (there are always problems) lie. --------------------------------

jb
 
OK then, can you recommend any tutorials that may help me?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top