<div id="test/Div" class="divStyle" style="border:2px solid #000000"> hello world </div>
<script language="JavaScript" type="text/javascript">
alert(document.getElementById("test/Div").id)
</script>
<script language="JavaScript" type="text/javascript">
alert(document.getElementById("test/Div").id)
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> new document </title>
<meta name="generator" content="editplus" />
<meta name="author" content="Gao YiXiang" />
<meta name="email" content="[email protected]" />
<meta name="keywords" content="javascript dhtml dom" />
<meta name="description" content="I love web development." />
</head>
<body>
<input type="text" id="test$Div" value="OK" />
<input type="text" id="test_Div" value="OK OK" />
<script type="text/javascript">
<!--
alert(test$Div.value);
alert(test_Div.value);
//-->
</script>
</body>
</html>
不过就不能使用document.all.a/b.innerHTML这样的方式获取
原则上可以有某些特殊符号
-----------
<input name="a/b">
<script>
document.all("a/b").value=10;
</script>
-------------
但是要尽量限制不要有特殊符号
也不要把名字取得太特殊
“字段是用户输入的”,但是页面也可以有一些规则,不是他想输什么就接受什么。