<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
function changerButton(){
var link = document.getElementById("links");
link.innerHTML = "NetEasy";//改变a标签里的内容即改变了Sina
link.href = "http://www.163.com";//链接改变了
}
</script>
</head>
<body>
<a href="http://www.sina.com">Sina</a>
<input type="button" value="Change" id="myButton" onclick="changerButton()"/>
</body>
</html>
javascript里的一些应用:例如<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
var count = 0;
var st;
function showDiv() {
count++;
if(count >=10) {
clearTimeout(st);
} else {
var div = document.getElementById("myDiv");
div.innerHTML = div.innerHTML + "I love you!";
st = setTimeout("showDiv()",200);
}
}
</script>
</head>
<body>
<div id="myDiv"></div>
<input type="button" value="I love you!" onclick="showDiv()" />
</body>
</html>