我必須對以下簡單的HTML頁面進行哪些更改才能讓Firefox讀取和設置自定義屬性,就像它在IE中一樣?自定義HTML屬性:Firefox vs IE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Original Value</title>
</head>
<body>
<div MyAttribute="Original Value" id="Label1">Hello World</div>
<form method="post">
<table style="width: 100%">
<tr>
<td>
<input name="Button1" onclick="button1_click();" type="button" value="button" /></td>
</tr>
</table>
<script type="text/javascript">
function button1_click(){
alert("Enter");
//alert("Label1.MyAttribute " + Label1.MyAttribute);
alert(Label1.getAttribute("MyAttribute"));
Label1.MyAttribute = "Updated";
alert("Label1.MyAttribute " + Label1.MyAttribute);
}
</script>
</form>
</body>
</html>
爲什麼倒票?......只是出於好奇:] – Atli 2009-12-11 18:12:18