PDA

View Full Version : Magic Slate script not working in firefox. WHY ?



FunaGuy
01-13-2008, 03:50 AM
<SCRIPT type="text/javascript" language="javascript" id="clientEventHandlersJS">
var st=" Mein to pagal ho gaya hoon! mera dimag kharab ho gaya hain! kaam kar kar ke mein dukhi ho chuka hoon is company mein?";
st+=" Arey ye kya ho raha hai? mujhe kya type karne ko kaha aur mein kya type kar raha hun. Kya kaam karte karte mera dimaag itna ghoom gayaa hai..ki mein kuch aur soch hi nahin paa raha hoon....hey bhagwaan yeh mujhe kahan pe fasaa diya re tune...kaise kaise log..aur kaise hai yeh comany... i see i see i.....";
st+="Mujhe yeh sab likhna nahin hai. Mujhe kisi aise ka naam likhna hai jisko mein sabse zyaada pasand karte hun.";
st+=" ";
st+=" buffalo buffalo.buffalo buffalo.buffalo buffalo.buffalo buffalo";
st+=" miss u always";
st+=" i love u my buffalo";
st+=" u know i m dying to marry u .my buffalo..........";
st+=" luv u buffalo darling ";
st+=" HAHAHAHHAHAHAAAAAAAAAAAAAAAAAAAAAAAAAA ";
var s="";
var i=0;
function window_onload() {
textarea1.focus();
}
function textarea1_onkeydown() {
s+=st.charAt(i);
i++;
if(i>=st.length)
i=0;
textarea1.value=s;
}

</SCRIPT>

<TEXTAREA language="javascript" id="textarea1" onkeydown="return textarea1_onkeydown()" name="textarea1" rows="12" cols="66"></TEXTAREA>

Page link:
http://www.funarulez.com/fun/magic-slate.htm

IE: Working
FF: Not

Twey
01-13-2008, 05:09 AM
I'd write it more like this:
<textarea id="textarea1" onkeydown="this.value = st.substr(0, this.value.length);" name="textarea1" rows="12" cols="66"></textarea>The textarea_onkeydown function is superfluous, as are the variables s and i.

Don't forget to validate (http://validator.w3.org/check?uri=http%3A%2F%2Fwww.funarulez.com%2Ffun%2Fmagic-slate.htm) your HTML (as HTML 4.01 Strict).

FunaGuy
01-13-2008, 09:31 PM
Thanks Twey !

Its works !! :)