<! DOCTYPE html>
<meta http-equiv= "Content-type" content= "Text/html;charset=utf-8" >
<script type= "Text/javascript" >
Window.onload=function () {
Read-Write attribute node
Attribute node is a property of a specified element node
(1) Get the specified element node first
var nameNode = document.getElementById ("name");
(2) The value of the specified property is read
alert (Namenode.value);
(3) Setting the value of the specified property
Namenode.value= "Good magic";
/**var Bjnode = document.getElementById ("BJ");
Alert ("I want to go to Beijing");
var bqnode = document.getelementsbytagname ("Li");
Alert ("This is tagged with!!!! ");
var nameNode = document.getelementsbyname ("Sex");
Alert ("This is based on the name attribute"); **/
}
</script>
<body>
<p> the city:</p> you want to go
<ul id= "City" >
<li id= "BJ" name= "Beijing" > Beijing </li>
<li> Shanghai </li>
</ul>
<br></br>
<p> The games you like:</p>
<ul id= "Game" >
<li id= "LOL" > League of Legends </li>
<li> Warcraft </li>
</ul>
<br></br>
Sex
<input type= "Radio" name= "Sex" value= "man"/> Male
<input type= "Radio" name= "Sex" value= "women"/> Female
<br></br>
Name
<input type= "text" name= "UserName" value= "name" id= "name"/>
</body>
Modify properties in JS