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: 1938
Discussions: 200,919, Posts: 2,379,079, Members: 246,287
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? (2850)
Obama the Muslim (13)
Why is Khalid Sheikh Mohammed even .. (9)
Is the PSU I received dead? (10)
windows vista security holes (8)
Foreign voltage (10)
Print spooler problem (13)
HIS HD5770 graphic card question (15)
Install XP pro and a Vista laptop ?.. (9)
Dept. of HS: NSA 'Helped' Develop V.. (15)
A good PSU? (10)
New Computer wont recognize XP disc (7)
Ideal cheap graph card for PC-Gamin.. (15)
EVGA 9800 gtx help with finding a g.. (8)
Recent Discussions
[F@H SPAM 11/16/09] ! 1/2 months to r.. (34)
Wireless speakers for PC? (11)
Print spooler problem (13)
Help getting around port 80 for camer.. (2)
Display shows 3x5 inch in middle of s.. (3)
windows vista security holes (8)
monitor will not turn on at all, (1)
World's largest Monopoly Game using G.. (331)
Foreign voltage (10)
FiOS modem/router interfering with ne.. (7)
Browsers wont load websites (2)
Virus Doctor Popup? (1)
Dept. of HS: NSA 'Helped' Develop Vis.. (15)
Install XP pro and a Vista laptop ?? (9)
EVGA 9800 gtx help with finding a goo.. (8)
Modern Warfare For the PC (32)
Problem with speed step/turbo boost? (1)
Modern Warfare 2: Who Bought It? (61)
SIS 740 and Widescreen (8)
Baffling Problem with my CPU/MoBo's. .. (0)
HIS HD5770 graphic card question (15)
Best file format to play on Windows H.. (0)
PSP Go bought in Japan (0)
Asus P4G8X Mobo (3)
Need hard disk drivers (4)


All times are GMT -4. The time now is 08:40 PM.
TechIMO Copyright 2009 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