滑鼠移動到P標簽上時,改變文本和邊框樣式 ...
滑鼠移動到P標簽上時,改變文本和邊框樣式
<style type="text/css"> .onmouseover { color: red; border: 1px solid blue; cursor: hand; </style> <script type="text/javascript"> function over() { var p = document.getElementById("p"); //選擇器className修改。 p.className = "onmouseover"; } function out() { var p = document.getElementById("p"); p.className = ""; } </script> <body> <p onmouseover="over()" onmouseout="out()" id="p">滑鼠移動到P標簽上時,改變文本和邊框樣式</p> </body>