<!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd "><HTMLxmlns= "http://www.w3.org/1999/xhtml"><Head><Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" /><title>Untitled Document</title></Head><Body></Body></HTML><Script>vara=Prompt ("Please enter an integer","can only be integers");if(A!=NULL){ varb=IsNaN (a); if(b==false) { varC=parseint (a); varsum=0; for(varI=1; I<=C;i++) {sum+=i; } alert (sum); } Else{alert ("wrong input! "); }}Else{}</Script>
<!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd "><HTMLxmlns= "http://www.w3.org/1999/xhtml"><Head><Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" /><title>Untitled Document</title></Head><Body>Please enter a number:<inputtype= "text"ID= "text"/> <inputtype= "button"value= "Please click"onclick= "Add ()"/></Body></HTML><Script>functionAdd () {vara=document.getElementById ("text"); varb=IsNaN (A.value); if(b==false) { varC=parseint (A.value); varsum=0; for(varI=0; I<=C;i++) {sum+=i; } document.write (sum); } Else{alert ("wrong input! "); }}</Script>
Scripting language practice summing up