Wu Yuxiong - natural born JAVASCRIPT development of learning: DOM - changing the HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body>

<script>
document.write(Date());
</script>

</body>
</html>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body>

<p id="p1">Hello World!</p>
<script>
document.getElementById("p1").innerHTML="新文本!";
</script> 
< P > of the above paragraphs modify the text by a script. </ P > 

</ body > 
</ HTML >

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body>

<h1 id="header">旧标题</h1>
<script>
var element=document.getElementById("header");
element.the innerHTML New Title"=" ;
 </ Script > 
< P > " Old Title "is" substituted with the new title. " </ P > 

</ body > 
</ HTML >

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body>

<img id="image" src="smiley.gif" width="160" height="120">
<script>
document.getElementById("image").src="landscape.jpg" ;
 </ Script > 
< the p- > original picture for smiley.gif, the script will be changed to the picture landscape.jpg </ the p- > 

</ body > 
</ HTML >

 

Guess you like

Origin www.cnblogs.com/tszr/p/10943768.html