Help - Search - Members - Calendar
Full Version: Random number generator
HTMLHelp Forums > Programming > Client-side Scripting
Oops!
Hello

I am trying to figure out the best way to go about generating a random number but having that number stored on a separate html page.

I am setting up a forum that allows quest posting but I wish to offer a way for the OP to request thread deletion or an edit, The only way I can see to achieve this would be to generate a random code to be displayed after thread creation (which I have a script for) but I then need to save that code in the thread with a conditional so that only admin and mods can see but I cant seem to figure out how to store the generated number into a separate html page.

If anyone has any ideas it would be much appreciated, below is the script I am currently looking at.


CODE
<script LANGUAGE="JavaScript">
num= new Array(16);
for (i=0; i<16; i++) {
num[i]=Math.floor(16*Math.random()+1);
if (num[1]==num[0]) {
while (num[1]==num[0]) {
num[1]=Math.floor(16*Math.random()+1);
   }
}
if (num[2]==num[1] || num[2]==num[0]) {
while (num[2]==num[1] || num[2]==num[0]) {
num[2]=Math.floor(16*Math.random()+1);
   }
}
if (num[3]==num[2] || num[3]==num[1] || num[3]==num[0]) {
while (num[3]==num[2] || num[3]==num[1] || num[3]==num[0]) {
num[3]=Math.floor(16*Math.random()+1);
   }
}
document.write(num[i],"");
}
</SCRIPT>
pandy
You can't do things like that with JavaScript as it only exists in the browser, i.e. it can't write to files on the server.

Doesn't your forum require login? In that case it should be enough that the member who asks for deletion is the same as started the thread.
Oops!
Thanks, I think that saved me some wasted time researching.

To answer your question, No it does not require login so I am seeking a solution for proof of thread ownership for the odd few that request changes or deletion.
remoteasgiven
Hi everyone
talking about random numbers,
I would like to show you a true random number generator. http://remoteasgiven.altervista.org/
bye
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.