<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>js基础--js修改div内容</title>
</head>
<body>
<!--修改id="boldStuff" 的内容-->
<script type="text/javascript">
function changeText(){
document.getElementById('boldStuff').innerHTML = '今生因你痴狂,此爱天下无双。';
}
</script>
<p>Welcome to the site <b id='boldStuff'>dude</b> </p>
<input type='button' οnclick='changeText()' value='Change Text'/>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>js基础--js修改div内容</title>
</head>
<body>
<!--修改id="boldStuff" 的内容-->
<script type="text/javascript">
function changeText(){
document.getElementById('boldStuff').innerHTML = '今生因你痴狂,此爱天下无双。';
}
</script>
<p>Welcome to the site <b id='boldStuff'>dude</b> </p>
<input type='button' οnclick='changeText()' value='Change Text'/>
</body>
</html>