Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Symplifying my Javascript navigation rollover menu
Old 04-24-2008, 07:57 PM Symplifying my Javascript navigation rollover menu
goheadtry's Avatar
Webmaster Talker

Posts: 726
Name: John
Location: United States of America, California
Trades: 0
Okay I made this script in dreamweaver I am just wondering how I can make it simpiler because I don't like having tons of code
HTML Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<link href="main.css" rel="stylesheet" type="text/css">
<script 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];}
}
//-->
</script>
</head>

<body onLoad="MM_preloadImages('navigation/home_h.jpg','navigation/games_h.jpg','navigation/videos_h.jpg','navigation/forum_n.jpg','navigation/articles_h.jpg')">

<div id="outer">
  <div id="header"><img src="logo.jpg" alt="TechnologyForever.com" width="283" height="80"></div>
  <div id="navigation"><a href="http://www.technologyforever.com/" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Home','','navigation/home_h.jpg',1)"><img src="navigation/home_n.jpg" alt="Home" name="Home" width="61" height="27" border="0"></a><a href="http://www.technologyforever.com/game1.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Games','','navigation/games_h.jpg',1)"><img src="navigation/games_n.jpg" alt="Games" name="Games" width="72" height="27" border="0"></a><a href="http://www.technologyforever.com/video1.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Videos','','navigation/videos_h.jpg',1)"><img src="navigation/videos_n.jpg" alt="Videos" name="Videos" width="72" height="27" border="0"></a><a href="http://www.technologyforever.com/forums/" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Forums','','navigation/forum_h.jpg',1)"><img src="navigation/forum_n.jpg" alt="Forums" name="Forums" width="67" height="27" border="0"></a><a href="http://www.technologyforever.com/blogtf/" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Articles','','navigation/articles_h.jpg',1)"><img src="navigation/articles_n.jpg" alt="Articles" name="Articles" width="83" height="27" border="0"></a></div>
</div>
</body>
</html>
__________________
Free $1 gift card when you signup at
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

goheadtry is offline
Reply With Quote
View Public Profile Visit goheadtry's homepage!
 
 
Register now for full access!
Old 05-13-2008, 01:06 AM Re: Symplifying my Javascript navigation rollover menu
goheadtry's Avatar
Webmaster Talker

Posts: 726
Name: John
Location: United States of America, California
Trades: 0
maybe know one has understood what I meant, so I figured I would make it more clear is there a way I can can include the javascript file separately and call upon it?
__________________
Free $1 gift card when you signup at
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

goheadtry is offline
Reply With Quote
View Public Profile Visit goheadtry's homepage!
 
Old 05-13-2008, 04:22 PM Re: Symplifying my Javascript navigation rollover menu
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,528
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
put it in an external file

<script src="path_to_file/file.js" type="text/javascript"></script>
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-13-2008, 08:05 PM Re: Symplifying my Javascript navigation rollover menu
logic ali's Avatar
Super Talker

Posts: 104
Trades: 0
Quote:
Originally Posted by chrishirst View Post
put it in an external file

<script src="path_to_file/file.js" type="text/javascript"></script>
Also do not include in the .js file the <script> tags or the HTML comments: <!-- -->, which aren't needed anyway.
logic ali is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Symplifying my Javascript navigation rollover menu
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13157 seconds with 12 queries