Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 03-13-2005, 07:30 AM   #1
Member (7 bit)
 
Join Date: Jan 2002
Location: Barcelona
Posts: 85
external js file and repeated function

Hi,
I would like to take the following function out of my xhtml page and link to it via an external js file.
In most cases I know how to do this but this function is repeated on many pages BUT with different 'variables' (I never know the right word!).
This is what I have on my pages at the moment (each using different images):


Code:
function makeArray() {
this.length = makeArray.arguments.length
for (var i = 0; i < this.length; i++) this[i+1] = makeArray.arguments[i]
}
var teams = new makeArray ("images/products/boston_compact1.png", "images/products/boston_compact2.png");
var eatMe = 1;
function flipper() {
document.form.image.src = teams[eatMe];
eatMe += 1;
if (eatMe == 3) eatMe = 1;
setTimeout("flipper()", 4000);
}
So, the images are different from page to page... how can I prepare these functions to be put in one external file and take account of the different images used?
Can I make them:
function makeArray1()
function makeArray2()
function makeArray3() etc. ?


Thanks for any ideas,
Craig

Last edited by craigtaylor74; 03-13-2005 at 07:34 AM. Reason: missing code tags
craigtaylor74 is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 07:19 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2