輸出的結(jié)果只有 JavaScript
<!DOCTYPE html>
<html>
?? ?<head>
?? ??? ?<meta http-equiv="content-type" content="text/html; charset=utf-8">
?? ??? ?<title>calssName屬性</title>
?? ??? ?<style type="text/css">
?? ??? ??? ?input{
?? ??? ??? ??? ?font-size: 10px;
?? ??? ??? ?}?? ?
?? ??? ?.one{
?? ??? ??? ?width: 200px;
?? ??? ??? ?background-color: #CCC;?? ??? ??? ?
?? ??? ?}
?? ??? ?.two{
?? ??? ??? ?font-size: 18px;?? ??? ?
?? ??? ??? ?color:#F00;
?? ??? ?}
?? ??? ?</style>
?? ?</head>
?? ?<body>
?? ??? ?<p id = "con" class="one">JavaSprict<p>
?? ??? ?<form
?? ??? ??? ?input type = "button" value = "點擊更改" onclick="modifyclass()"?? ?>
?? ??? ?</form>
?? ??? ?<script type = "text/javasprit">
?? ??? ??? ?var mychar = document.getElementById("con");
?? ??? ??? ?document.write("p元素calss值為:"+mychar.className+"<br/>");//輸出p元素給的屬性
?? ??? ??? ?function modifyclass(){
?? ??? ??? ??? ?mychar.className = "two";//改變className
?? ??? ??? ?}
?? ??? ?</script>
?? ?</body>
</html>
2018-11-03
你的p段那個標(biāo)簽內(nèi)容只有JavaSprict啊
2019-06-04
感覺都是漏洞
2019-02-15
form 標(biāo)簽沒有封閉;
input 標(biāo)簽沒有封閉;
text/javascript 拼寫錯誤。
2018-11-03
有一句代碼寫錯了,應(yīng)該是<script type="text/javascript">