Re: FN-FORUM: javascript beginner
date posted 24th January 2006 10:48
[EMAIL REMOVED] wrote:
> Hi,
>
> I'm just doing a course on javascript (total javascript beginner) and wrote
> the following lines:
>
> var biggestNumber;
> var theSum=0;
>
> biggestNumber=window.prompt('Please input a value ','');
> biggestNumber=parseFloat(biggestNumber);
> for(var count = 1; count {
> theSum = theSum + count
> window.alert('The sum of the numbers from 1 to ' + biggestNumber + ' is ' +
> theSum)
>
> Now the next calculation I'm supposed to do is: to calculate the sum of the
> numbers from 1 to 10,000, and I need to post the result of the output.
>
> Where and how do I test my program? I wrote it in notepad and tried viewing
> it in a browser, but must be doing something wrong? Sorry, this is probably
> a really silly question, but I'm kind of stuck.
>
> Thanks in advance for your patience,
Gina,
You need to wrap your program in a minimal HTML page to get it working.
I've put a simple example online at
http://mag-sol.com/playground/add.html
View the source to see what it going on.
Dave...
--
Magnum Solutions Ltd
Open Source Consultancy, Development and Training