JavaScript - I Hate Ie - :)
Hi folks
I am new to JavaScript and I am having some difficulties with this small snippet of code. The code works fine in Firefox, Chrome etc, but internet explorer it does sweet f**k all . Some guidance would be greatly appreciated? <script> document.getElementById("find_artist").addEventListener("click",find_event,false); function find_event(){ document.upcoming_form.event.value = document.getElementById('event').value; document.upcoming_form.submit(); } </script> Many Thanks Joe Similar TutorialsHello All, i understand there is a certain way to write Pseudocode but i have looked it up on several different websites but i get different hints from each and really do not understand. Any improvements you can think of for the below? i have used the word define alot !! i don't think i should either. Code: <body> <html> <head> <title>Find the Correct Number Game By sam Horne</title> <H1><font color="black">Find the Correct Number Game</font></H1> </body> </html> <SCRIPT LANGUAGE='javascript'> a=(prompt('Please enter your name:',0)); // prompt for player name document.write(" Hello " + a + " and welcome to my game! The aim of the game is to find the correct number which is between 1 and 50. The Higher Lower Indicator will guide you in the right direction. Start by entering any number you wish. Enjoy!!");// print a to screen guessme=Math.round(Math.random()*(50)+1); // generates 1 - 50 truly randomly speech='Choose a number between 1 and 50'; // defined variable function process(hiddennumber) { // defines process guessnumber=document.forms.guesstable.guessnumber.value;// defined variable // defined variable to write to guesstable in guessnumber field speech='"'+guessnumber+ '" Letters are not allowed. Please enter digits only!.'; // defined variable document.forms.guesstable.guessnumber.value=''; // print guessnumber to guesstable form if (guessnumber==hiddennumber)// if guessnumber = hiddennumber Congratulations! hiddennumber is correct! { document.forms.guesstable.prompt.value='Congratulations! '+hiddennumber+' is correct!'; alert ('Congratulations you have guessed the correct number which was'+hiddennumber+'! \n\nIf you want to play again click the button.'); speech=''; document.location=document.location; } if (hiddennumber<guessnumber) // if hiddennumber < guessnumber - lower than guessnumber { speech='Lower than '+ guessnumber; } if (hiddennumber>guessnumber) // if hiddennumber > guessnumber - higher than guessnumber { speech='Higher than '+ guessnumber; } if (guessnumber=='') // if guessnumber is blank - you need to enter a number { speech='You need to enter a number and not leave it blank' } document.forms.guesstable.prompt.value=speech; // document.forms.guesstable.guessnumber.focus(); } </SCRIPT> <FORM onSubmit='' NAME='guesstable'> <CENTER> <TABLE ALIGN='left' BGCOLOR='#000000'> <TR> <TD BGCOLOR='#0000ff'> <FONT COLOR='#ffffff" FACE='comic sans ms'><B>Find the Correct Number</B></FONT> </TD> </TR> <TR> <TD> <CENTER> <INPUT TYPE='text' NAME='prompt' SIZE='50' MAXLENGTH='60' VALUE='Higher Lower Indicator'><BR> // define text length <INPUT TYPE='text' NAME='guessnumber' SIZE='22' MAXLENGTH='2' VALUE='Enter your number here'> //define text length <INPUT TYPE='button' VALUE='Submit' onClick='process(guessme)'> // define button </CENTER> </TD> </TR> </TABLE> </CENTER> </FORM> |