代码应该在<script>
包含鼠标悬停事件的标记之间使用 javascript,并且 HTML 页面中的列表项的样式必须如下所示:正常 - 黑色,12,粗体和黄色,15,粗体,斜体。
<html>
<head>
<title> Using mouseover eve </title>
<script language = "javascript">
<!--
function changeStyle() {
var item = document.getElementByTagName("li");
item.style.color = "yellow";
item.style.fontSize = "15pt";
item.style.fontWeight = "bold";
item.style.fontStyle = "italic";
}
-->
</script>
</head>
<body>
<ul style = "color: black; font-size: 12pt; font-weight: bold" >
<li onMouseOver = "changeStyle()"> item 1 </li>
<li onMouseOver = "changeStyle()"> item 2 </li>
</ul>
</body>
</html>