改变途径
<html>
<head>
<title>JavaScript</title>
</head>
<body>
<img id = "image" src = "E:/1.jpg"/>
<script>
document.getElementById("image").src = "E:/2.jpg";
</script>
<p>原始图片被修改</p>
</body>
</html>
改变样式
<html>
<head>
<title>改变HTML样式</title>
</head>
<body>
<p id = "p2">Hello World!</p>
<script>
document.getElementById("p2").style.color = "red";
</script>
</body>
</html>
<html>
<head>
<title>改变HTML样式</title>
</head>
<body>
<p id = "p1">Hello World!</p>
<p id = "p2">Hi World!</p>
<script>
document.getElementById("p2").style.color = "red";
document.getElementById("p2").style.fontFamily = "Arial";
document.getElementById("p2").style.fontSize = "larger";
</script>
</body>
</html>
<html>
<head>
<title>改变HTML样式</title>
</head>
<body>
<p id = "p1">Hello World!</p>
<p id = "p2">Hi World!</p>
<button type = "button" onclick = "document.getElementById('p2').style.color = 'red'">点这里</button>
</body>
</html>