HTML code:
1 <!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd ">2 <HTMLxmlns= "http://www.w3.org/1999/xhtml">3 <Head>4 <Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" />5 <title>Untitled Document</title>6 </Head>7 8 <Body>9 <form>Which year was the Republic of China founded?<inputtype= "text"Daan= "1912"value=""ID= "T1"name= "T1" />Ten <inputtype= "button"onclick= "Check ()"ID= "T2"name= "T2"value= "Check the answer" /> One </form> A </Body> - </HTML> - <Script> the functionCheck () - { - vara=document.getElementById ("T1"); - varA1=A.value; + varA2=A.getattribute ("Daan"); - if(A1==A2) + { A Alert ("congratulations on your answer."); at } - Else - {alert ("Stupid")} - } - </Script>
The effect is:
Do a problem if the input answer is correct then pops up correctly, error pop-up error