Webmaster Forum

Ezilon Directory   High Bandwidth Dedicated Servers   V7N Directory
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Reply
 
LinkBack Thread Tools Display Modes
Old 01-23-2008, 01:23 PM   #1 (permalink)
Contributing Member
 
Join Date: 09-18-07
Posts: 154
iTrader: 1 / 100%
Latest Blog:
None

NameJunky is liked by many
How to link javascript to an external file?

Hello all, I have a little bit of javascript in my index page and for SEO purposes I want to remove it from the index page and then link to it in an external file.

So this is what I have :
Code:
<script language="JavaScript" 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>
I cut all of that code and put it into a file and saved it as seoscript.js. Then I added this to my page:
Code:
<script src="seoscript.js"></script>
But now the javascript doesn't work. All it is is a rollover image script for the header links so it's not that big a deal, but it's just frustrating me! You can see what I mean by looking at my main page and hovering over the top links, and then look at the SEO page. The rollover images won't work on the SEO page.
NameJunky is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 01-23-2008, 02:37 PM   #2 (permalink)
v7n Mentor
 
Costin Trifan's Avatar
 
Join Date: 04-13-07
Location: Romania (atm)
Posts: 2,846
iTrader: 0 / 0%
Costin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web pro
there is definitely something wrong with that seo page. open it up in Firefox and form Tools menu item select Error Console and you'll find what's generating your error...

Are you loading the same images? because they doesn't look to be the same (comparing the index and the seo page)
__________________
Costin Trifan is offline  
Add Post to del.icio.us
Reply With Quote
Old 01-23-2008, 11:25 PM   #3 (permalink)
Contributing Member
 
Join Date: 07-24-06
Posts: 565
iTrader: 1 / 100%
Latest Blog:
None

nasty.web is a jewel in the roughnasty.web is a jewel in the roughnasty.web is a jewel in the roughnasty.web is a jewel in the roughnasty.web is a jewel in the roughnasty.web is a jewel in the roughnasty.web is a jewel in the roughnasty.web is a jewel in the rough
Remove
Code:
<script language="JavaScript" type="text/JavaScript"> <!--
from the beginning.
And
Code:
//--> </script>
from the end of your http://directorysubmissions.biz/seoscript.js.
nasty.web is offline  
Add Post to del.icio.us
Reply With Quote
Old 01-25-2008, 02:47 AM   #4 (permalink)
v7n Mentor
 
Costin Trifan's Avatar
 
Join Date: 04-13-07
Location: Romania (atm)
Posts: 2,846
iTrader: 0 / 0%
Costin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web pro
roflmao... I've seen that before!
__________________
Costin Trifan is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you make an external HTML file load into a slice in Fireworks? ChetG Web Design Lobby 8 09-05-2007 02:51 PM
Moving Java Script to an external file redgsr SEO Forum 7 01-09-2006 06:02 AM
How can I insert a menu in text form into an external .css file Jason Web Design Lobby 1 11-19-2004 08:38 AM
linking to an external .css file Jason Coding Forum 2 11-17-2004 09:26 AM
Using a single external scripts file? digitman Web Design Lobby 7 09-28-2004 01:16 PM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 10:52 PM.
© Copyright 2008 V7 Inc


Search Engine Optimization by vBSEO 3.1.0 ©2007, Crawlability, Inc.