Say Hello! Networking for Professionals
Register Get Password Search Today's Posts Mark Forums Read
Join the Discussion

Not a member yet? Register for FREE!
Go Back   Join the Discussion / Discussion Groups / Science & Technology
Reload this Page JavaScript

Science & Technology Discuss various technologies, finance and science.

JOIN TODAY! It's FREE . . . Discuss topics and issues that matter to you!

8,000 active members posting their views, facts and opinions on issues and topics that are important to people of today.

Join a Discussion or better yet and Start a Discussion of your own!

Reply
 
Thread Tools
Old 05-31-2007   #1 (permalink)
Tobster
Just getting started
 
Join Date: May 2007
Posts: 6
Default JavaScript

Hi

I kind of hitting Desperation point and really need a volenteer to help me out. Apart of my Open Uni course is about JavaScript and I am having problems getting my head around it...

If there anyone out there willing to help me learn it I would be VERY grateful and it will mean the differents between passing and failing.

If you willing to help me just click on reply.

Thanks

Toby
Tobster is offline   Reply With Quote
Old 05-31-2007   #2 (permalink)
lakersforce
Drank to much Mountain Dew
 
lakersforce's Avatar
 
Join Date: May 2007
Location: Odense, dk
Posts: 391
Send a message via MSN to lakersforce
Default Re: JavaScript

Why don't you descripe your problem...?
lakersforce is offline   Reply With Quote
Old 05-31-2007   #3 (permalink)
Tobster
Just getting started
 
Join Date: May 2007
Posts: 6
Default Re: JavaScript

Hi

I was not expecting such a speedy response, which is very cool. What it 11.45pm now in the UK and I got to get up at 4am for work so I will add to this tomorrow if that o.k with you?

Alternatively you could e-mail me at toby.whaymand@ntlworld.com

Thanks

Toby
Tobster is offline   Reply With Quote
Old 05-31-2007   #4 (permalink)
brandx
Eligible for a custom title
 
brandx's Avatar
 
Join Date: May 2007
Location: Michigan, USA
Posts: 485
Default Re: JavaScript

Sounds good toby, hopefully we can help out when you get a chance to post more details.
My blog
Formerly - ubuntu-geek
brandx is offline   Reply With Quote
Old 05-31-2007   #5 (permalink)
Extreme Coder
^_^;
 
Extreme Coder's Avatar
 
Join Date: May 2007
Location: Cairo,Egypt
Posts: 1,203
Default Re: JavaScript

Yeah, I once tried out JavaScript, not a bad language at all. Waiting to see what your problem is
Extreme Coder is offline   Reply With Quote
Old 06-01-2007   #6 (permalink)
lakersforce
Drank to much Mountain Dew
 
lakersforce's Avatar
 
Join Date: May 2007
Location: Odense, dk
Posts: 391
Send a message via MSN to lakersforce
Default Re: JavaScript

I recieved the following PM from Tobster:

I got to fix the following programme and say what the errors are:

<HTML>
<HEAD> M 150 TMAO3 Question 1 (i)
<TITLE>Enter a number </TITLE>
<SCRIPT language="JavaScript" >
var userInput;
var userNumber;
var upperLimit = 20;
userInput = window.prompt('Please enter a number in
the range 1 to ' + upperLimit,'');
userNumber = parseFloat(userInput);
while ((userNumber <= 1) || (userNumber >=
upperLimit))
{
UserInput = window.prompt('Please re-enter - number
should be in range 1 to + upperLimit, '')
}
document.write('<BR>'+'Your chosen number was ' +
yourNumber)
</SCRIPT>
</HEAD>
<BODY>
</BODY>
</HTML>

If could help me out I would be very greatful it will also help me learn.

This does mean a lot to me so thanks

Toby
lakersforce is offline   Reply With Quote
Old 06-01-2007   #7 (permalink)
lakersforce
Drank to much Mountain Dew
 
lakersforce's Avatar
 
Join Date: May 2007
Location: Odense, dk
Posts: 391
Send a message via MSN to lakersforce
Default Re: JavaScript

I can see a syntax error right here:

userInput = window.prompt('Please enter a number in
the range 1 to ' + upperLimit,'');

should be:

userInput = window.prompt('Please enter a number in
the range 1 to ' + upperLimit,');
lakersforce is offline   Reply With Quote
Old 06-02-2007   #8 (permalink)
lakersforce
Drank to much Mountain Dew
 
lakersforce's Avatar
 
Join Date: May 2007
Location: Odense, dk
Posts: 391
Send a message via MSN to lakersforce
Default Re: JavaScript

Allow me to BUMP this post....or TTT if you prefer
lakersforce is offline   Reply With Quote
Old 06-02-2007   #9 (permalink)
qtwerp
Retired User
 
qtwerp's Avatar
 
Join Date: May 2007
Posts: 372
Default Re: JavaScript

Note: Blue indicates additions, green comments, red possible removals, and red italic removals

<SCRIPT language="JavaScript" >
var userInput;
var userNumber;
var upperLimit = 20;
userInput = window.prompt('Please enter a number in' +
//You need to terminate the string and use the + sign to concatenate the two strings if you're going to go to multiple lines
'the range 1 to ' + upperLimit,'');
userNumber = parseFloat(userInput);
//Need the ' to say it's a string and the default value is optional. Since you don't have anything useful in there, you might as well leave it out
while ((userNumber <= 1) || (userNumber >=
upperLimit))
{
UserInput = window.prompt('Please re-enter - number' +
'should be in range 1 to' + upperLimit, '');
//Again terminate the string on the first line and use the + to concatenate. The text on the second line is not as a string so put the single quotes around it. Still nothing useful for the second part. Again, since it's optional, you can leave it out.
//You also forget to check for valid input. If the user inputs invalid information the first time, they'll be stuck in an infinite loop. You need code here to fix that.
}
document.write('<BR>'+'Your chosen number was ' +
//Why make that two strings? It's not necessary.
yourNumberuserNumber);
//yourNumber? It's been userNumber throughout the script
</SCRIPT>


It seems your biggest problem is just making a string cover multiple lines. You can always put each string on one line to avoid problems.

Last edited by qtwerp : 06-02-2007 at 04:54 PM. Reason: cleanup
qtwerp is offline   Reply With Quote
Old 06-04-2007   #10 (permalink)
Tobster
Just getting started
 
Join Date: May 2007
Posts: 6
Default Re: JavaScript

Thanks everyone it means alot to me
Tobster is offline   Reply With Quote
Reply


Thread Tools



All times are GMT -5. The time now is 05:57 PM.



vBulletin® Version 3.6.7. Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.0.0 ©2007, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32