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
needed: htm script pointing to a javascript
Old 03-08-2008, 08:47 PM needed: htm script pointing to a javascript
Chimpie's Avatar
Novice Talker

Posts: 12
Trades: 0
On a few of my sites I have this (sample) script...
Quote:
<script language="JavaScript">
<!--



function random_imglink(){
var myimages=new Array()
//specify random images below. You can have as many as you wish
myimages[1]="image1.gif"
myimages[2]="image2.gif"
myimages[3]="image3.gif"
myimages[4]="image4.gif"
myimages[5]="image5.gif"
myimages[6]="image6.gif"

//specify corresponding links below
var imagelinks=new Array()
imagelinks[1]="http://www.javascriptkit.com"
imagelinks[2]="http://www.netscape.com"
imagelinks[3]="http://www.microsoft.com"
imagelinks[4]="http://www.dynamicdrive.com"
imagelinks[5]="http://www.freewarejava.com"
imagelinks[6]="http://www.cnn.com"

var ry=Math.floor(Math.random()*myimages.length)
if (ry==0)
ry=1
document.write('<a href='+'"'+imagelinks[ry]+'"'+'><img src="'+myimages[ry]+'" border=0></a>')
}
random_imglink()
//-->
</script>
What I would like to do is to save the above as some sort of file, then have a script that points to it so my banners will load. That way I can change, add and delete banners from one location, instead of going to multiple sites and multiple templates to make the change.

What do I need to do?

Thanks!
Chimpie is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-08-2008, 09:20 PM Re: needed: htm script pointing to a javascript
Moxxnixx's Avatar
King Spam Talker

Posts: 1,174
Name: Lance
Location: Virginia Beach
Trades: 0
All you need to do is paste your js code into a new textfile and name it... whatever.js
Get rid of <scriptlanguage="JavaScript"> and </script> tags. You don't need them.

Wherever you want the js to run, just put the following tag...
Code:
<script src="http://www.yoursite.com/whatever.js"></script>
__________________
Get your facts first, and then you can distort them as much as you please. - Mark Twain

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

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

All My Sites Are Proudly Hosted @
Please login or register to view this content. Registration is FREE

Moxxnixx is offline
Reply With Quote
View Public Profile Visit Moxxnixx's homepage!
 
Old 03-08-2008, 10:00 PM Re: needed: htm script pointing to a javascript
Chimpie's Avatar
Novice Talker

Posts: 12
Trades: 0
Quote:
Originally Posted by Moxxnixx View Post
All you need to do is paste your js code into a new textfile and name it... whatever.js
Get rid of <scriptlanguage="JavaScript"> and </script> tags. You don't need them.

Wherever you want the js to run, just put the following tag...
Code:
<script src="http://www.yoursite.com/whatever.js"></script>
Does any other code need to be on the page to run the javascript? Cause it's not work.
Chimpie is offline
Reply With Quote
View Public Profile
 
Old 03-08-2008, 10:25 PM Re: needed: htm script pointing to a javascript
Moxxnixx's Avatar
King Spam Talker

Posts: 1,174
Name: Lance
Location: Virginia Beach
Trades: 0
Can you give me a link to the site?
__________________
Get your facts first, and then you can distort them as much as you please. - Mark Twain

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

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

All My Sites Are Proudly Hosted @
Please login or register to view this content. Registration is FREE


Last edited by Moxxnixx; 03-09-2008 at 01:57 AM..
Moxxnixx is offline
Reply With Quote
View Public Profile Visit Moxxnixx's homepage!
 
Old 03-09-2008, 12:54 AM Re: needed: htm script pointing to a javascript
Chimpie's Avatar
Novice Talker

Posts: 12
Trades: 0
Let me send you a PM with all the details.
Chimpie is offline
Reply With Quote
View Public Profile
 
Old 03-09-2008, 01:13 AM Re: needed: htm script pointing to a javascript
Moxxnixx's Avatar
King Spam Talker

Posts: 1,174
Name: Lance
Location: Virginia Beach
Trades: 0
I checked your page and you had an incorrect path in the script src tag.
Hope that fixes it.
__________________
Get your facts first, and then you can distort them as much as you please. - Mark Twain

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

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

All My Sites Are Proudly Hosted @
Please login or register to view this content. Registration is FREE

Moxxnixx is offline
Reply With Quote
View Public Profile Visit Moxxnixx's homepage!
 
Old 03-09-2008, 01:32 AM Re: needed: htm script pointing to a javascript
Chimpie's Avatar
Novice Talker

Posts: 12
Trades: 0
Quote:
Originally Posted by Moxxnixx View Post
I checked your page and you had an incorrect path in the script src tag.
Hope that fixes it.
LOL... it doesn't. PM sent.
Chimpie is offline
Reply With Quote
View Public Profile
 
Old 03-09-2008, 01:39 AM Re: needed: htm script pointing to a javascript
Moxxnixx's Avatar
King Spam Talker

Posts: 1,174
Name: Lance
Location: Virginia Beach
Trades: 0
Your banners.js file has been altered somehow.

There's a bunch of strange characters in it.
What kind of editor are you using?

UPDATE:
Problem solved. The js file has been fixed. Good luck.
__________________
Get your facts first, and then you can distort them as much as you please. - Mark Twain

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

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

All My Sites Are Proudly Hosted @
Please login or register to view this content. Registration is FREE


Last edited by Moxxnixx; 03-09-2008 at 01:56 AM.. Reason: UPDATE
Moxxnixx is offline
Reply With Quote
View Public Profile Visit Moxxnixx's homepage!
 
Reply     « Reply to needed: htm script pointing to a javascript
 

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.26694 seconds with 12 queries