Lunarpages Web Hosting Forum

Author Topic: Unable to save Javascript code for image slide show  (Read 4338 times)

Offline Admiral4life

  • Trekkie
  • **
  • Posts: 17
Unable to save Javascript code for image slide show
« on: February 02, 2005, 11:20:14 PM »
I have the following code in my htm file

<html
<head>
...
....
<script language="JavaScript"><!-- Begin
// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 5000;
// Duration of crossfade (seconds)
var crossFadeDuration = 3;
// Specify the image files
var Pic = new Array();
// to add more images, just continue
// the pattern, adding to the array below
Pic[0] = 'comment1.jpg';
Pic[1] = 'comment2.jpg';
Pic[2] = 'comment4.jpg';
Pic[3] = 'comment3.jpg';
var t;
var j = 0;
var p = Pic.length;
var preLoad = new Array();
for (i = 0; i < p; i++) {
preLoad = new Image();
preLoad.src = Pic;
}
function runSlideShow() {
if (document.all) {
document.images.SlideShow.style.filter="blendTrans(duration=2)";
document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
document.images.SlideShow.filters.blendTrans.Apply();
}
document.images.SlideShow.src = preLoad[j].src;
if (document.all) {
document.images.SlideShow.filters.blendTrans.Play();
}
j = j + 1;
if (j > (p - 1)) j = 0;
t = setTimeout('runSlideShow()', slideShowSpeed);
}
//  End -->
</script>
</head>
<body bgcolor="#ffffff" onload="runSlideShow()">
...
..
...
</body>
</html>

Now for some reason, when this htm file is uploaded to the my public_html folder, the body line is being changed to
<body bgcolor="#ffffff" onload="runSlideShow()&amp;quot;&quot;">
I think because of it , I dont get to see my image slide show
Each time I try to edit via cPanel, it just adds more &amp;quot .

I have no idea why I am unable to save it. The code works fine locally , but I just dont understand what is going wrong when I upload the file
Any help would be greatly appreciated.

Offline TWebMan

  • Quantum Encyclopedia Writer
  • *****
  • Posts: 3047
    • Take charge of your site
Unable to save Javascript code for image slide show
« Reply #1 on: February 02, 2005, 11:33:29 PM »
Are you on a Windows system?

Can you edit the file in notepad or some other text editor to make sure the code is correct then upload via an ftp client?
"Computers cause people to make more mistakes than any other invention in history, with the possible exception of handguns and tequila."  - Unknown
"Liberty of any kind is seldom lost all at once." - D. Hume
Every day is an Ode to Joy
The planet will be fine... and so will your site

Offline Admiral4life

  • Trekkie
  • **
  • Posts: 17
Unable to save Javascript code for image slide show
« Reply #2 on: February 03, 2005, 08:27:06 AM »
Yes, Thats what I meant by the code is working fine locally. I do see the image slide show when I open the page locally on my windows system.


But when I ftp it , for some reason the code changes . I know this sounds bizarre but thats what happening.
I even copy/pasted from my notepad into the html editor in cPanel , but after save it , it  edits the onLoad line on its own   :?

Offline TWebMan

  • Quantum Encyclopedia Writer
  • *****
  • Posts: 3047
    • Take charge of your site
Unable to save Javascript code for image slide show
« Reply #3 on: February 03, 2005, 09:22:50 AM »
Only that line.  ???

Even upon FTP.  ???

I can't help but think it's your system somehow basically html-encoding that specific piece of the file.  But why?

I do know that if you paste that into the design view of many web editors that's what you'll get, but not in notepad.  And, I don't see how it would get changed upon a normal ASCII ftp transfer.  Even a binary transfer wouldn't cause that specific issue.
"Computers cause people to make more mistakes than any other invention in history, with the possible exception of handguns and tequila."  - Unknown
"Liberty of any kind is seldom lost all at once." - D. Hume
Every day is an Ode to Joy
The planet will be fine... and so will your site

Offline Admiral4life

  • Trekkie
  • **
  • Posts: 17
Unable to save Javascript code for image slide show
« Reply #4 on: February 03, 2005, 09:48:22 AM »
No, it is saved fine locally. I edit it locally using notepad.

The problem is tht the image is not being displayed , only I see the big "X" in its place. But I do think that the slide show is running , because I do see "Transferring data " on the bottom of the page after every 15 sec, when I increased the slide show speed to 15sec.

Can anyone point me out to another script for slide show ?

Offline TWebMan

  • Quantum Encyclopedia Writer
  • *****
  • Posts: 3047
    • Take charge of your site
Unable to save Javascript code for image slide show
« Reply #5 on: February 03, 2005, 09:49:47 AM »
Pic[0] = 'comment1.jpg';
Pic[1] = 'comment2.jpg';
Pic[2] = 'comment4.jpg';
Pic[3] = 'comment3.jpg';

The images are in the same directory as the file?
"Computers cause people to make more mistakes than any other invention in history, with the possible exception of handguns and tequila."  - Unknown
"Liberty of any kind is seldom lost all at once." - D. Hume
Every day is an Ode to Joy
The planet will be fine... and so will your site

Offline Admiral4life

  • Trekkie
  • **
  • Posts: 17
Unable to save Javascript code for image slide show
« Reply #6 on: February 03, 2005, 11:10:21 AM »
Yes, for debugging purposes I had placed it in the same directory..
Also, there are no semi-colons after each pic..

Here is the webpage
http://www.osmm.com/CareerMainFrame.htm

Offline TranzNDance

  • Princess of Naboo
  • Berserker Poster
  • *****
  • Posts: 11567
    • Thu Tu's Blog
Unable to save Javascript code for image slide show
« Reply #7 on: February 03, 2005, 11:17:45 AM »
Where on that page should the slideshow be?
:whip: :love: :whip: :love: :whip: :love:

Offline Admiral4life

  • Trekkie
  • **
  • Posts: 17
Unable to save Javascript code for image slide show
« Reply #8 on: February 03, 2005, 11:19:34 AM »
Right below the line
"Some of Our Floating Staff's Comments about Working with OSMM "
Currently, it has "x" instead

Offline TranzNDance

  • Princess of Naboo
  • Berserker Poster
  • *****
  • Posts: 11567
    • Thu Tu's Blog
Unable to save Javascript code for image slide show
« Reply #9 on: February 03, 2005, 11:22:33 AM »
It points to this file which doesn't exist: http://www.osmm.com/comment1.jpg Make sure capitalization is correct. Linux is case-sensitive.
:whip: :love: :whip: :love: :whip: :love:

Offline Admiral4life

  • Trekkie
  • **
  • Posts: 17
Unable to save Javascript code for image slide show
« Reply #10 on: February 03, 2005, 12:00:34 PM »
Thanks , that was one of the problems.

Now I am using IE (previously it was mozilla) , and this time the line onLoad=onload="runSlideShow()" is not getting saved. I am using the file manager in cPanel.

I edit the file in html code , and then I click on design in order to save it..but it still removes that line
When I click on preview (before saving it) everything is working fine

Offline Admiral4life

  • Trekkie
  • **
  • Posts: 17
Unable to save Javascript code for image slide show
« Reply #11 on: February 03, 2005, 12:27:27 PM »
I meant onLoad="runSlideShow()"  ( not two onLoads)

leighsww

  • Guest
Unable to save Javascript code for image slide show
« Reply #12 on: February 03, 2005, 12:36:23 PM »
Admiral4life, you can use the "Edit post" in the upper right-hand corner of the post you want to edit, if you ever need to change something in your posts :thumb:

Offline Admiral4life

  • Trekkie
  • **
  • Posts: 17
Unable to save Javascript code for image slide show
« Reply #13 on: February 03, 2005, 01:18:27 PM »
My bad. Will remember next time.
So can some mod/admin do the editing for me using something other than html editor? Since we don't get telnet access, is there any other way of editing that file ?

Offline TranzNDance

  • Princess of Naboo
  • Berserker Poster
  • *****
  • Posts: 11567
    • Thu Tu's Blog
Unable to save Javascript code for image slide show
« Reply #14 on: February 03, 2005, 01:21:31 PM »
Instead of using html editor in cpanel, please try simple editing. I'm wondering if you are editing in the incorrect mode and the code isn't being recognized as code but rather content.
:whip: :love: :whip: :love: :whip: :love: