home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

Added JavaScript and it totally cocked up my menu bar :(

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 1422
Discussions: 200,507, Posts: 2,374,395, Members: 245,831
Old March 15th, 2003, 12:28 AM   Digg it!   #1 (permalink)
Member
 
Join Date: Jan 2003
Location: England
Posts: 165
Added JavaScript and it totally cocked up my menu bar :(

stuff like this annoys me

i made myself a menu bar, basically it was 8 or 9 images downwards, each one was a button with some text on. When i just put the images on top of each other it worked fine... when i made them all links it still looked fine.

Then when i added my JavaScript function to put image swaps in it spaced them all out even though ive specified BORDER=0 in the img tag.

You can see what i mean in the attached image (ive made the bgcolor=red so you can see the space more clearly).

This is the code:

Code:
<HTML>


<HEAD>
<TITLE>Gergehtrhrth</TITLE>
 
<SCRIPT LANGUAGE="JavaScript">
  function menuSwap(name, type)  
  {
   eval("document." + name + ".src = 'images/menu_" + type + ".gif'");
  }
</SCRIPT>

</HEAD>



<BODY TOPMARGIN=0 BOTTOMMARGIN=0 LEFTMARGIN=0 RIGHTMARGIN=0 BGCOLOR=RED>
            <TABLE WIDTH=118 CELLSPACING=0 CELLPADDING=0>
             <TR HEIGHT=37>
              <TD>
               <A HREF="index.html"
                ONMOUSEOVER="menuSwap('news', 'news2');"
                ONMOUSEOUT="menuSwap('news', 'news1');">
                <IMG SRC="images/menu_news1.gif" WIDTH=118 HEIGHT=37 BORDER=0 ALT="News" NAME=news>
               </A>
             </TD>
             </TR>
             <TR HEIGHT=37>
              <TD>
               <A HREF="history.html"
                ONMOUSEOVER="menuSwap('history', 'history2');"
                ONMOUSEOUT="menuSwap('history', 'history1');">
                <IMG SRC="images/menu_history1.gif" WIDTH=118 HEIGHT=37 BORDER=0 ALT="History" NAME=history>
               </A>
             </TD>
             </TR>
             <TR HEIGHT=37>
              <TD>
               <A HREF="roster.html"
                ONMOUSEOVER="menuSwap('roster', 'roster2');"
                ONMOUSEOUT="menuSwap('roster', 'roster1');">
                <IMG SRC="images/menu_roster1.gif" WIDTH=118 HEIGHT=37 BORDER=0 ALT="Roster" NAME=roster>
               </A>
             </TD>
             </TR>
             <TR HEIGHT=37>
              <TD>
               <A HREF="rules.html"
                ONMOUSEOVER="menuSwap('rules', 'rules2');"
                ONMOUSEOUT="menuSwap('rules', 'rules1');">
                <IMG SRC="images/menu_rules1.gif" WIDTH=118 HEIGHT=37 BORDER=0 ALT="Rules" NAME=rules>
               </A>
             </TD>
            </TR>
           </TABLE>
</BODY>


</HTML>
It really irritates me when ive got something to work then i add something that should make no difference to the layout and it does ><!

Anyone know what the crack is with this?
Attached Thumbnails
added-javascript-totally-cocked-up-my-menu-bar-annoying.gif  
__________________
~Fade2Grey
Fade2Grey is offline   Reply With Quote
Old March 15th, 2003, 12:53 AM     #2 (permalink)
Senior Member
 
Join Date: Oct 2001
Location: Alberta, Canada
Posts: 563
I seem to remember this as being one of those stupid "quirks" that I ran into a long time ago...
try removing any spaces between the tags.

for example: (note the red sections)

Code:
<TD>< A HREF="rules.html"
      ONMOUSEOVER="menuSwap('rules', 'rules2');"
      ONMOUSEOUT="menuSwap('rules', 'rules1'); ><IMG 
      SRC="images/menu_rules1.gif" WIDTH=118 HEIGHT=37 
      BORDER=0 ALT="Rules" NAME=rules></A></TD>

instead of:

<TD>
  < A HREF="rules.html"
       ONMOUSEOVER="menuSwap('rules', 'rules2');"
       ONMOUSEOUT="menuSwap('rules', 'rules1');">
       <IMG SRC="images/menu_rules1.gif" WIDTH=118 HEIGHT=37 BORDER=0 ALT="Rules" NAME=rules>
      </A>
  </TD>
I know it makes for ugly code, so indent as you would like... not sure if it'll fix it, but giver a try!

Cheers!
^hyd^ is offline   Reply With Quote
Old March 15th, 2003, 12:55 AM     #3 (permalink)
Banned
 
thronka's Avatar
 
Join Date: Dec 2002
Location: Garland, Texas USA
Posts: 1,785
make sure you use the <br> instead of a hard enter that seems like a double enter.
thronka is offline   Reply With Quote
Old March 15th, 2003, 01:27 AM     #4 (permalink)
Member
 
Join Date: Jan 2003
Location: England
Posts: 165
Quote:
Originally posted by ^hyd^
I seem to remember this as being one of those stupid "quirks" that I ran into a long time ago...
try removing any spaces between the tags.

for example: (note the red sections)

Code:
<TD>< A HREF="rules.html"
      ONMOUSEOVER="menuSwap('rules', 'rules2');"
      ONMOUSEOUT="menuSwap('rules', 'rules1'); ><IMG 
      SRC="images/menu_rules1.gif" WIDTH=118 HEIGHT=37 
      BORDER=0 ALT="Rules" NAME=rules></A></TD>

instead of:

<TD>
  < A HREF="rules.html"
       ONMOUSEOVER="menuSwap('rules', 'rules2');"
       ONMOUSEOUT="menuSwap('rules', 'rules1');">
       <IMG SRC="images/menu_rules1.gif" WIDTH=118 HEIGHT=37 BORDER=0 ALT="Rules" NAME=rules>
      </A>
  </TD>
I know it makes for ugly code, so indent as you would like... not sure if it'll fix it, but giver a try!

Cheers!

Yay! It worked... thanks so much, this forum never fails to amaze me. And yeah it does make ugly code, but it also makes a pretty webpage so im happy.

Thanks again ^hyd^

Woohoo...
Fade2Grey is offline   Reply With Quote
Old March 18th, 2003, 11:36 PM     #5 (permalink)
Junior Member
 
Join Date: Mar 2003
Posts: 10
just by looking i now know not to run into that problem too Woo-Hoo!
DarkLord33 is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (1635)
FT HOOD attack: 7 killed 12 injured (66)
Review My Build (5)
HELP!!! What do you think of this s.. (16)
Looking for a graphic card that wil.. (30)
Assosiations (21496)
My 1st pc build (40)
Aero in Vista (7)
PC Modern Warfare 2: it's much wors.. (12)
core i7 extreme 975, nvidia 9400gt (9)
How to Ship a PC (16)
Building my first computer (13)
slaving laptop drive (7)
[F@H SPAM 11/1/09]New month . . . n.. (33)
Recent Discussions
how to convert mod to wmv/avi/mp4/mov.. (0)
FAT32 to NTFS file system in Win2kpro (3)
Motherboards and my curse... (25)
Review My Build (5)
HELP!!! What do you think of this sys.. (16)
New Processor, Monitor will not turn .. (2)
2009 Build (4)
Internet very slow since updating AVG.. (7)
My 1st pc build (40)
Freezing During Music/Movies (1)
Windows Experience Index is screwed u.. (2)
ext. sound card laptop to stereo syst.. (2)
Remote Desktop via SSH and error mess.. (2)
Help and Support disappeared from my .. (0)
[F@H SPAM 11/1/09]New month . . . new.. (33)
Basic applications needed for "r.. (1)
core i7 extreme 975, nvidia 9400gt (9)
hard drive problem (2)
Win7 TrustedInstaller Permissions (2)
Speed up Win 7 boot time a bit (1)
Hard Drive test program (2)
wireless westell versalink model 327w (1)
New build 10 second reboot cycle! Won.. (3)
New Linksys Routers (2)
sometime power/Amber light (0)


All times are GMT -4. The time now is 04:44 AM.
TechIMO Copyright 2008 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28