Play Music and videos
<! DOCTYPE html>
<body>
<audio controls= "Controls" >
<source src= "1122qww.ogg" type= "Audio/ogg" >
<source src= "1122qqww.mp3" type= "Audio/mpeg" >
</audio>
<video width= "720" height= "610" controls= "Controls" >
<source src= "Unix.ogg" type= "Video/ogg" >
<source src= "Unix.mp4" type= "Video/mp4" >
</video>
</body>
Link
<! DOCTYPE html>
<body>
<a href= "Mailto:[email protected]" >
Email US
</a> <br/>
<a href= "http://www.sina.com.cn" >
Visit sina.com.cn!
</a> <br/>
<a href= "http://www.baidu.com" >
Visit baidu!
</a> <br/>
</body>
Create button
<script language=javascriptd>
Function judge () {
var score = prompt ("Is you Fenshu?");
}
</script>
<form>
<input type= "button" value= "click it" onclick = "Judge ()" >
</form>
<button onmouseover= "Judge ()" >show12</button>
<!-onmouseover/onmouseout/onclick->
to create a JS object from a JSON string
<body>
Create objects with JSON strings
<p>
First Name: <span id= "fname" ></span><br/>
Last Name: <span id= "lname" ></span><br/>
</p>
<script type= "Text/javascript" >
var txt = ' {' Employees ': [' +
' {' firstName ': ' Bill ', ' lastName ': ' Gates '}, ' +
' {' firstName ': ' George ', ' lastName ': ' Bush '}, ' +
' {' firstName ': ' Thomas ', ' lastName ': ' Carter '}]} ';
var obj = eval ("(" + txt + ")"); <!- equivalent to obj = json.parse (txt);->
document.getElementById ("FName"). Innerhtml=obj.employees[1].firstname
document.getElementById ("LName"). Innerhtml=obj.employees[1].lastname
</script>
</body>
Create a JSON object in JavaScript
<body>
Create a JSON object in JavaScript
<p>
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" >
var jsonobject= {
"Name": "Bill Gates",
"Street": "Fifth Avenue New York 666",
"Age": 56,
"Phone": "555 1234567"};
document.getElementById ("Jname"). Innerhtml=jsonobject.name
document.getElementById ("Jage"). Innerhtml=jsonobject.age
document.getElementById ("Jstreet"). Innerhtml=jsonobject.street
document.getElementById ("Jphone"). Innerhtml=jsonobject.phone
</script>
</body>
HTML Small Code