Enjoy an ad free experience by logging in. Not a member yet? Register.
|
|
Results 1 to 9 of 9
-
04-05-2016, 10:39 PM #1New to the CF scene
- Join Date
- Apr 2016
- Location
- Thornlie, Western Australia
- Posts
- 5
- Thanks
- 0
- Thanked 0 Times in 0 Posts
How to accept 'N', randomise 0, 1, ... N, then display result within html code.
Hallo
Beginning with a html file, say index.html, how do I 'embed' within it Javascript to do the following?
I have done it in Fortran but that requires a user to download an .exe file in order to use the program.
The task is:
- Accept via the keyboard an integer 'N', where N is greater than zero.
- (A user would be given the option of entering zero or less to terminate the program).
- Verify that N is within the range (inclusive) 1 to an upper positive limit.
- Randomise the sequence 0, 1, .... N.
- Display the randomised sequence on the screen so it may be copied or printed.
This is the real task of truly random voting, or more precisely pseudo-random, as a mathematical algorithm cannot be truly random.
But 'random-enough' is good enough
Zero is included as even a single candidate presents options - Yes/No or 1/0.
Thanking the reader, in anticipation.
Eric in Thornlie, Western Australia.
-
04-06-2016, 07:38 AM #2Senior Coder
- Join Date
- Jan 2010
- Location
- Behind the Wall
- Posts
- 4,556
- Thanks
- 14
- Thanked 476 Times in 471 Posts
by using script tags.Beginning with a html file, say index.html, how do I 'embed' within it Javascript
if you need a start with JavaScript, check out MDN.The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.André Behrens, NY Times Software Developer
-
04-06-2016, 02:41 PM #3Senior Coder
- Join Date
- Jan 2004
- Location
- chertsey, a small town 25 miles south west of london, england.
- Posts
- 2,192
- Thanks
- 0
- Thanked 336 Times in 329 Posts
Hi there eric_carwardine,
and a warm welcome to these forums.
check out the attachment, to see a possible solution.
coothead~ the original bald headed old fart ~
-
04-06-2016, 03:13 PM #4New to the CF scene
- Join Date
- Apr 2016
- Location
- Thornlie, Western Australia
- Posts
- 5
- Thanks
- 0
- Thanked 0 Times in 0 Posts
-
04-06-2016, 03:31 PM #5New to the CF scene
- Join Date
- Apr 2016
- Location
- Thornlie, Western Australia
- Posts
- 5
- Thanks
- 0
- Thanked 0 Times in 0 Posts
-
04-06-2016, 03:50 PM #6Senior Coder
- Join Date
- Jan 2004
- Location
- chertsey, a small town 25 miles south west of london, england.
- Posts
- 2,192
- Thanks
- 0
- Thanked 336 Times in 329 Posts
Hi there eric_carwardine,
I am just an amateur who codes for the mental stimulation that itCan I attribute the code to you, in some way?
provides and with the hope that it may stave of senile dementia.
If the code in any way suits your purpose, please feel free to use
it however you like, and with no strings attached.
coothead~ the original bald headed old fart ~
-
04-06-2016, 11:18 PM #7New to the CF scene
- Join Date
- Apr 2016
- Location
- Thornlie, Western Australia
- Posts
- 5
- Thanks
- 0
- Thanked 0 Times in 0 Posts
Yes, this dementia is an insidious thing; you catch it from your children, I'm told {glum smilie}
I think I'll immunise myself by becoming 'Speaker on Anything' (Speak anywhere, except possibly the Antarctic - too many ants - on any topic).
Okay, thanks
I'll probably include a link saying something like "Code generously supplied through CodingForums.com"
P.S. How does one add a signature, as in your reference to hairless flatulence? I had expected to be able to do so by editing my profile but cannot see a way of so doing.
Eric
-
04-06-2016, 11:42 PM #8Senior Coder
- Join Date
- Jan 2004
- Location
- chertsey, a small town 25 miles south west of london, england.
- Posts
- 2,192
- Thanks
- 0
- Thanked 336 Times in 329 Posts
Hi there Eric
The signature editing is reached by "Settings" > "My Settings" > "Edit Signature".
I have a sneaky suspicion, though, that this facility is only made available to those
who have made a specified number of posts.
You would need to check my assertion with a moderator, just in case I have suffered
another one of my "Senior Moments" or, as I prefer to call to them; "brain farts".
coothead~ the original bald headed old fart ~
-
04-10-2016, 12:12 AM #9New to the CF scene
- Join Date
- Apr 2016
- Location
- Thornlie, Western Australia
- Posts
- 5
- Thanks
- 0
- Thanked 0 Times in 0 Posts
Ah-hah! Yet one more possible example of the world being ruled by algorithms
Your suspicion could be well-founded coothead, when I look at "My Settings" Unless my installation of the forum is disadvantaged I may not yet have reached the critical number of posts.
I shall not bother them. I'm sure their attention is being claimed by matters more imperative than my deprivation
Ears were invented for relieving the pressure of cranial flatulence, the bone structure of the auditory canal serving as a non-return valve in case the relief should occur while submerged.
However, when relief in a marine environment is indicated there is one thing the reliever should never, never, never do.
"Ewik" - My signature



Reply With Quote
