I have an external JS file/function that does a calculation based on numbers entered into a form. If the output of the function equals 8 characters, then I want to control the display of it’s output so that it looks like a typewriter or decryption effect. If not, then it would just give an error message. The variable that holds the information is ‘sn’ inside of functionXYZ().
Now to the actual question….
I found a couple of cut-and-paste JS that do what I want, but can’t seem to get my results to display. In the HTML doc, they use a
[code=html]<div id=”whatever”>Text that displays with effects here.</div>
The id tells the JS what text to display. I assumed that I could just change it to read
[code=html]<div id=”whatever”><script>functionXYZ();</script></div>
but that displays “functionXYZ();” and then my results.
I should explain that I currently have the if-then-else setup as:
[CODE]if (sn.length == 8){
document.write(sn)
else {
document.write(‘ERROR’)
};
Someone told me that I really shouldn’t use document.write for this situation, but didn’t give me any alternatives.
Here’s a link to the decrypting text I wanted to use: [URL=http://i-code.co.uk/javascript/decryptingtext.php]Decrypting Text
One other smaller problem is that I would like the decrypting effect to only use random numbers and NOT random characters. I thought I could just change all the ‘char’ variables to ‘num’. Obviously, that didn’t work.
Any help is appreciated!