代码编辑器:
x
1
<script>
2
function displayResult(){
3
document.getElementById("p1").style.fontStyle="italic";
4
}
5
</script>
6
<p id="p1">这是一些文本</p>
7
<br>
8
<button type="button" onclick="displayResult()">修改字体style</button>
9
<script>
function displayResult(){
document.getElementById("p1").style.fontStyle="italic";
}
</script>
<p id="p1">这是一些文本</p>
<br>
<button type="button" onclick="displayResult()">修改字体style</button>