HTML Small Code

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.