js.php
<script>functionmessage () {Alert (The prompt box is called through the OnLoad event. ")}</script>Email: <input type= "text" name= "email" size= "><input type=" Submit "value=" Submit "> </form></body> Document. Write ("Generate text, these are written after/html")//Generate textdocument.write ("//generate plain text and labelsfunctionFunctiona () {document. Write ("If document.write is executed after the document has finished loading, the entire HTML page will be overwritten:");}functionfunctionb () {document. getElementById ("a"). Innerhtml= "Replace a"; Document. getElementById ("B"). Innerhtml= "Replace after B";}functionFunctionc (Name,job) {Alert ("Welcome" + name + ", the" +job);}varab= "Attached value";d ocument. getElementById ("C"). innerhtml=AB;functionvalidate_required (field,alerttxt) {with (field) {if(value==NULL|| value== "") {alert (alerttxt);return false} Else{return true} }}functionValidate_form (thisform) {with (thisform) {if(validate_required (email, "Email must be filled out!") ==false) {Email. focus ();return false} }}</script>
jquery.php
<script type= "Text/javascript" src= "jquery.js" ></script><script type= "Text/javascript" >functiongetelements () {varX=document.getelementsbyname ("Myinput"); Alert (x.length);}functionCreatenewdoc () {varNewdoc=document.open ("text/html", "Replace"); vartxt= "; Newdoc.write (TXT); Newdoc.close ();}</script>number of anchors in the document:<script type= "Text/javascript" >Document. Write (document.anchors.length)</script><br><br><a name= "First" > Anchor </a><br/><a name= "Second" > second anchor </A><BR/><a name= "Third" > Third anchor </a><br/>The InnerHTML of the first anchor in this document is:<script type= "Text/javascript" >Document. write (Document.anchors[0].InnerHTML)</script><br><br><form name= "Form1" ></form><form name= "Form2" ></form> <form name= "FORM3" ></form><script type= "Text/javascript" >Document. Write ("document contains:" + Document.forms.length + "forms.) ")</script><br><br><form id= "Form1" name= "Form1" >Your name:<input type= "text" ></form><form id= "Form2" name= "Form2" >Your car:<input type= "text" ></form><script type= "Text/javascript" >Document. write (<p> to access items in the collection, you can use both the project number: "+ document.forms[0].name +" </p> ") Document. Write ("<p> to access items in the collection, you can also use the project name:" + document.getElementById ("Form1"). Name + "</p>")</script>
ajax.php
<script type= "Text/javascript" >functionShowcustomer (str) {varXMLHTTP; if(str== "") {document. getElementById ("Txthint"). Innerhtml= ""; return; }if(Window.XMLHttpRequest) {//code for ie7+, Firefox, Chrome, Opera, Safarixmlhttp=NewXMLHttpRequest (); }Else {//code for IE6, IE5xmlhttp=NewActiveXObject ("Microsoft.XMLHTTP"); }xmlhttp. onreadystatechange=function() { if(Xmlhttp.readystate==4 && xmlhttp.status==200) {document. getElementById ("Txthint"). Innerhtml=xmlhttp.responsetext; }}xmlhttp. Open ("GET", "/ajax/getcustomer.asp?q=" +str,true); XMLHTTP.send ();}</script>Please select a customer:<select name= "Customers" onchange= "Showcustomer (this.value)" style= "Font-family:verdana, Arial, Helvetica, Sans-serif; " ><option value= "APPLE" >apple computer, inc.</option><option value= "BAIDU" >baidu, Inc</ Option><option value= "Canon" >canon USA, inc.</option><option value= "Google" >google, Inc.</ Option><option value= "Nokia" >nokia corporation</option><option value= "SONY" >Sony Corporation of america</option></select></label></form><br/><div id= "TxtHint" > Customer information will be listed here ...</div>
json.php
Name: <span id= "Jname" ></span><br/> Age: <span id= "Jage" ></span><br/>Address: <span id= "Jstreet" ></span><br/>Phone: <span id= "Jphone" ></span><br/></p><script type= "Text/javascript" >varjsonobject= {"Name": "Bill Gates", "Street": "Fifth Avenue New York 666", "Age": page, "Phone": "555 1234567"};d ocument. getElementById ("Jname"). Innerhtml=jsonobject.namedocument. getElementById ("Jage"). Innerhtml=jsonobject.agedocument. getElementById ("Jstreet"). Innerhtml=jsonobject.streetdocument. getElementById ("Jphone"). Innerhtml=jsonobject.Phone</script>
PHP JS various knowledge points