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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

javascript blues

Status
Not open for further replies.

singersower

Technical User
Jan 5, 2005
20
US
I'm not quite up on my javascript and I want to have a rollover button I made in photoshop...why isn't it working?

the site is: [] it is the 'announcements'button on the left nav bar

the <head> script looks like this:

Code:
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("1")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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_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];}
}
and the body looks like

Code:
<body onload="FP_preloadImgs(/*url*/'buttons/button6.jpg', /*url*/'buttons/button7.jpg', /*url*/'buttons/button16.jpg', /*url*/'buttons/button17.jpg', /*url*/'buttons/button1F.jpg', /*url*/'buttons/button20.jpg', /*url*/'buttons/button22.jpg', /*url*/'buttons/button23.jpg', /*url*/'buttons/button2B.jpg', /*url*/'buttons/button2C.jpg', /*url*/'buttons/button38.jpg', /*url*/'buttons/button39.jpg'); MM_preloadImages('buttons/images/bfleftnavannounce1_01-down.gif')" topmargin="0" leftmargin="0">
and later:
Code:
<font color="#FFFFFF"><span style="text-decoration: none"><br>&nbsp;&nbsp; </span></font></a></font></span></font><a href="javascript:;" onMouseOver="MM_swapImage('leftnavannounce','','buttons/images/bfleftnavannounce1_01-down.gif',1)" onMouseOut="MM_swapImgRestore()">
    <img src="buttons/bfleftnavannounce1_01.gif" name="leftnavannounce" width="143" height="38" border="0" id="leftnavannounce"></a><br>


THANKS for any help!!
singersower
 
This:

/*url*/

before each button name is garbage in a plain HTML page, and you should remove all instances of it.

Lee
 
WELL, the /*url*/ in generated by frontpage and seems to be necessary for their buttons to work. I am going to try another route and try to get away from javascript.

Thanks for the help.
 
The joys of WYSIWYG-generated code. Did you try the suggestion? I've worked with fixing Front Page and Dreamweaver code like this in the past. I've been working with Javascript for quite a while, and can guarantee you that if you run the code you posted, it will give an error.

Lee
 
It appears that neither of your announcement buttons are in the images folder. If you put the URL in directly for both images, you'll get a page not found error.

Also, the scrolling marquee you have is IE only, so anyone visiting the site using a different browser won't see that.

Lee
 
You should probably design the site to look good for 800 x 600 screen resolution as well as the higher one you use on your own screen. It's pretty obvious at a glance that your own computer screen is set larger than that.

Lee
 
do they have to be in the top level images folder? Mine are in a sub web while I'm developing it: believersfellowship.info/New BF and then the buttons are in:

[buttons/images]. I tried putting absolute URL in....

NOPE
why do the frontpage generated ones work and not mine?

So, I tried generating new buttons with Fireworks and using dreamweaver to insert them. I would love to simplify this and do it with a css sheet instead of javascript.

I don't mind if everyone doesn't see the marquee, but I do want the navigation to work.


Aaaargh....any help appreciated

thanks
 
I'm checking out the zengarden right now :)
I found a thread referring to the resizing and resolution problem.
we'll see what happens :p

--singersower
 
It's not a good idea to use spaces in folder or file (page, image, etc.) names. I don't know if that's the problem you're having with the New BF folder or not.

The images you use for buttons total up to be wider than an 800 x 600 screen width, and that's stretching the page.

One of the problems you've encountered is relying on the canned code that the WYSIWYG web design programs spit out. The HTML source itself has a lot of excess stuff in it that these programs generate if you let them create the code from what you draw on the screen. Whenever I get a site to work on that has MM or FP in front of functions, I know I'm in for some redesign work.

Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top