• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

i need help

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi can any one help me with this code
i need to know what each line does exactly
< script language="JavaScript">

window.setTimeout("timer()",1000,"JavaScript")

function timer()

{

var s = document.all.item("jumpTime").innerText;

/* alert(s); */

var time = (s);

time = time - 1;

document.all.item("jumpTime").innerText = time;

if (time > 0) {

window.setTimeout("timer()",1000,"JavaScript");

}

}

< /script>
(edited by Cindy to add spaces so that it will not execute)
[This message has been edited by Cindy Glass (edited July 09, 2001).]
 
Ranch Hand
Posts: 625
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which code are you talking about exactly?
 
q8ygirl
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry for that, here is the code
< script language="JavaScript">

window.setTimeout("timer()",1000,"JavaScript")

function timer()

{

var s = document.all.item("jumpTime").innerText;

/* alert(s); */

var time = (s);

time = time - 1;

document.all.item("jumpTime").innerText = time;

if (time > 0) {

window.setTimeout("timer()",1000,"JavaScript");

}

}

< /script>
[This message has been edited by Cindy Glass (edited July 09, 2001).]
 
q8ygirl
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i posted the code but it dosent show here why???
< textarea name="S1" rows="10" cols="40">< script language="JavaScript">
< br>
window.setTimeout("timer()",1000,"JavaScript"
< br>
function timer()
< br>
{
< br>
var s = document.all.item("jumpTime" .innerText;
< br>
/* alert(s); */
< br>
var time = (s);
< br>
time = time - 1;
< br>
document.all.item("jumpTime" .innerText = time;
< br>
if (time > 0) {
< br>
window.setTimeout("timer()",1000,"JavaScript" ;
< br>
}
< br>
}
< br>
< /script>
(edited by Cindy to put spaces in JavaScript so that it would not execute)

[This message has been edited by Cindy Glass (edited July 09, 2001).]
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Firstly, in no time at all someone is going to come along and tell you that your name doesn't conform to the JavaRanch naming policy. Look out for the 'Tony Alicea' bot
The code you pasted is Javascript and not Java. If you asked in the http://www.javaranch.com/cgi-bin/ubb/forumdisplay.cgi?action=topics&forum=HTML+and+JavaScript&number=20&DaysPrune= HTML and Javascript forum you'd have better luck.
The reason your code didn't show up was because it was Javascript. When the browser tries to show it it tries to show it as javascript code (ie execute the code) rather than doing what you expected, which was printing it on the screen.
Dave.
(damn ubb code )
[This message has been edited by David O'Meara (edited July 08, 2001).]
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"q8ygirl",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.
Thanks.
(I'm not Tony, but will any Sheriff do?)
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic