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
Old 12-29-2010, 04:00 PM The full JS
Novice Talker

Posts: 5
Name: Joachim
Trades: 0
Hello all

I made a Javascript long time ago.
Now I need to move the JS to another website, but the problem is, when I try to move it, it won't work.
I went to w3school, to make sure it was possible to get a JS to work on the new place and it worked well, so I do something wrong in my copy/paste.

I would really appreciate if anyone could tell me what I have to copy to make it work on the new website.
The JS is on www.danish-matchrace.dk and as you probably know you can see the JS in sources (it should be in the top of the source)

I hope someone can help.

Joachim
JoachimA is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-29-2010, 04:36 PM Re: The full JS
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,383
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
And what is it supposed to do?

So we can probably tell what it isn't doing.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is 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 12-29-2010, 07:29 PM Re: The full JS
Novice Talker

Posts: 5
Name: Joachim
Trades: 0
Oh I'm sorry I didn't described clearly.

Well- I have it on my site now, and I need to get the same JS to my new site.
Problem is: When I copy paste it to the new site, it doesn't show up.
I think I miss something when I copy it, but I tried almost everything, so I ask for what/how much and I need to copy from the html sources?
JoachimA is offline
Reply With Quote
View Public Profile
 
Old 12-31-2010, 04:17 PM Re: The full JS
Super Spam Talker

Posts: 879
Name: Paul W
Trades: 0
Which is the site with the working js and which is the non-working? What exactly do you mean by "not working"? Does it misfunction or what?
__________________

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


*** New:
Please login or register to view this content. Registration is FREE
PaulW is online now
Reply With Quote
View Public Profile
 
Old 01-01-2011, 07:54 AM Re: The full JS
Novice Talker

Posts: 5
Name: Joachim
Trades: 0
It is working on the website on the link I wrote in the first post.
I need to move it from this website (the link) to a new website.

When I try to move it from the linked website to the new site it doesn't work.
What happen is simply: Nothing shows up.

What I ask for is: If someone could check the sources from the link and tell me what I have to copy, as I think I don't get it all included in my copy/paste.
JoachimA is offline
Reply With Quote
View Public Profile
 
Old 01-01-2011, 09:15 AM Re: The full JS
Super Spam Talker

Posts: 879
Name: Paul W
Trades: 0
Okay, there are three components to the task. (1) Copy everything in the head from open to close of the script tag. (2) Create a directory called script in the root directory of the new site and add images -- according to current script they should be 1.jpg, 2.jpg up to 11.jpg. (3) Add the onLoad call to your new body tag
__________________

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


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

Last edited by PaulW; 01-01-2011 at 09:18 AM..
PaulW is online now
Reply With Quote
View Public Profile
 
Old 01-02-2011, 01:21 PM Re: The full JS
Novice Talker

Posts: 5
Name: Joachim
Trades: 0
I tried to follow the steps and this is what I inserted, but it still doesn't work:


HTML Code:
<script type='text/javascript' language='javascript'>  
<!-- 
var interval = 4000; 
var random_display = 0;
var image_dir = ""
var ImageNum = 0;
imageArray = new Array();
imageArray[ImageNum++] = new imageItem(image_dir + "/Test/images/script/1.jpg");
imageArray[ImageNum++] = new imageItem(image_dir + "/Test/images/script/2.jpg");
imageArray[ImageNum++] = new imageItem(image_dir + "/Test/images/script/3.jpg");
imageArray[ImageNum++] = new imageItem(image_dir + "/Test/images/script/4.jpg");
imageArray[ImageNum++] = new imageItem(image_dir + "/Test/images/script/5.jpg");
imageArray[ImageNum++] = new imageItem(image_dir + "/Test/images/script/6.jpg");
imageArray[ImageNum++] = new imageItem(image_dir + "/Test/images/script/7.jpg");
imageArray[ImageNum++] = new imageItem(image_dir + "/Test/images/script/8.jpg");
imageArray[ImageNum++] = new imageItem(image_dir + "/Test/images/script/9.jpg");
imageArray[ImageNum++] = new imageItem(image_dir + "/Test/images/script/10.jpg");
imageArray[ImageNum++] = new imageItem(image_dir + "/Test/images/script/11.jpg");
 
var number_of_image = imageArray.length;
function imageItem(image_location) {
this.image_item = new Image();
this.image_item.src = image_location;
}
function get_ImageItemLocation(imageObj) {
return(imageObj.image_item.src)
}
function randNum(x, y) {
var range = y - x + 1;
return Math.floor(Math.random() * range) + x;
}
function getNextImage() {
if (random_display) {
ImageNum = randNum(0, number_of_image-1);
}
else {
ImageNum = (ImageNum+1) % number_of_image;
}
var new_image = get_ImageItemLocation(imageArray[ImageNum]);
return(new_image);
}
function getPrevImage() {
ImageNum = (ImageNum-1) % number_of_image;
var new_image = get_ImageItemLocation(imageArray[ImageNum]);
return(new_image);
}
function prevImage(place) {
var new_image = getPrevImage();
document[place].src = new_image;
}
function rotateImage(place) {
var new_image = getNextImage();
document[place].src = new_image;
var recur_call = "rotateImage('"+place+"')";
timerID = setTimeout(recur_call, interval);
}

//   -->
</script>
</head>
<body bgcolor=#8096ad onload="rotateImage('rImage')">

Last edited by chrishirst; 01-02-2011 at 06:28 PM..
JoachimA is offline
Reply With Quote
View Public Profile
 
Old 01-02-2011, 02:38 PM Re: The full JS
Super Spam Talker

Posts: 879
Name: Paul W
Trades: 0
Sorry, should have said, you need an image tag with the name rImage - if you look at the working page you'll see img src=... name ="rImage" The javascript puts the random selection there.
__________________

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


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

Last edited by PaulW; 01-02-2011 at 02:39 PM..
PaulW is online now
Reply With Quote
View Public Profile
 
Old 01-02-2011, 04:36 PM Re: The full JS
Novice Talker

Posts: 5
Name: Joachim
Trades: 0
We are getting closer!

Now picture 1.jpg shows up, BUT the script doesn't change picture..

It is now as follow:

HTML Code:
<script type='text/javascript' language='javascript'>  
<!-- 
var interval = 4000; 
var random_display = 0;
var image_dir = ""
var ImageNum = 0;
imageArray = new Array();
imageArray[ImageNum++] = new imageItem(image_dir + "/Test/images/script/1.jpg");
imageArray[ImageNum++] = new imageItem(image_dir + "/Test/images/script/2.jpg");
imageArray[ImageNum++] = new imageItem(image_dir + "/Test/images/script/3.jpg");
imageArray[ImageNum++] = new imageItem(image_dir + "/Test/images/script/4.jpg");
imageArray[ImageNum++] = new imageItem(image_dir + "/Test/images/script/5.jpg");
imageArray[ImageNum++] = new imageItem(image_dir + "/Test/images/script/6.jpg");
imageArray[ImageNum++] = new imageItem(image_dir + "/Test/images/script/7.jpg");
imageArray[ImageNum++] = new imageItem(image_dir + "/Test/images/script/8.jpg");
imageArray[ImageNum++] = new imageItem(image_dir + "/Test/images/script/9.jpg");
imageArray[ImageNum++] = new imageItem(image_dir + "/Test/images/script/10.jpg");
imageArray[ImageNum++] = new imageItem(image_dir + "/Test/images/script/11.jpg");
 
 
var number_of_image = imageArray.length;
function imageItem(image_location) {
this.image_item = new Image();
this.image_item.src = image_location;
}
function get_ImageItemLocation(imageObj) {
return(imageObj.image_item.src)
}
function randNum(x, y) {
var range = y - x + 1;
return Math.floor(Math.random() * range) + x;
}
function getNextImage() {
if (random_display) {
ImageNum = randNum(0, number_of_image-1);
}
else {
ImageNum = (ImageNum+1) % number_of_image;
}
var new_image = get_ImageItemLocation(imageArray[ImageNum]);
return(new_image);
}
function getPrevImage() {
ImageNum = (ImageNum-1) % number_of_image;
var new_image = get_ImageItemLocation(imageArray[ImageNum]);
return(new_image);
}
function prevImage(place) {
var new_image = getPrevImage();
document[place].src = new_image;
}
function rotateImage(place) {
var new_image = getNextImage();
document[place].src = new_image;
var recur_call = "rotateImage('"+place+"')";
timerID = setTimeout(recur_call, interval);
}

//   -->
</script>
<body onload="rotateImage('rImage')">
<img style="margin-top: 0px" src="/Test/images/script/1.jpg" width="250" name="rImage"/>

Last edited by chrishirst; 01-02-2011 at 06:27 PM..
JoachimA is offline
Reply With Quote
View Public Profile
 
Old 01-02-2011, 06:33 PM Re: The full JS
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,383
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Check your spelling and the case of the paths & names.


*nix servers are case SENSITIVE "Test" and "test" are NOT the same.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to The full JS
 

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