Peter
New Member
God
Posts: 6
|
Post by Peter on Oct 29, 2004 11:34:25 GMT
Code created by Webworldx[/color]
This will automatically add random numbers to your post where you specify. All you have to do is type <rand:44> and it'll put in a random number between 1 and 44. So like the censored words list, but you can use JS mathematical functions. Same can be done for other random stuff. And even better, every time the user loads the page, the random number *stays the same*.
<SCRIPT language="JavaScript"> <!-- function changeRand(){ var iCurPost=document.postmodify.message.value.split('<rand:') var iNewPost="" for(i=0;i<iCurPost.length;i++){ if(iCurPost[i].indexOf('>') !=-1){ var iKeep=iCurPost[i].split('>')[1] iCurPost[i]=iCurPost[i].split('>')[0] iCurPost[i]=Math.floor(Math.random() * parseInt(iCurPost[i])) iCurPost[i]+=iKeep } iNewPost+=iCurPost[i] } document.postmodify.message.value=iNewPost }
if ((location.href.indexOf('action=post') !=-1 || location.href.indexOf('action=reply') != -1) && location.href.indexOf('action=post2') ==-1){ document.postmodify.post[0].onclick=function(){changeRand()} } --> </SCRIPT>
Board footers.
|
|