<head>
<title>无标题文档</title>
</head>
<body >
<script language="javascript">
var astr="开始";
var aname=astr.anchor("start");
document.write(aname);
</script>
</body>
</html>
怎么都没显示呀?效果应该和<a name ="star">开始</a>是一样的呀!
直接用switch就好了
<html >
<head>
<title>无标题文档</title>
<script language="javascript">
function updateinfo(whichbook)
{
switch(whichbook)
{
case "a" : document.bookform.currbook.value="A书";
document.bookform.booktitle.value="语文";
document.bookform.bookpublisher.value="少年儿童出版社";
document.bookform.bookamount.value="10000";
break;
case "b" : document.bookform.currbook.value="B书";
document.bookform.booktitle.value="数学";
document.bookform.bookpublisher.value="高教育出版社";
document.bookform.bookamount.value="120000";
break;
case "c" : document.bookform.currbook.value="C书";
document.bookform.booktitle.value="计算机基础";
document.bookform.bookpublisher.value="清华出版社";
document.bookform.bookamount.value="50000";
break;
case "d" : document.bookform.currbook.value="D书";
document.bookform.booktitle.value="WEB程序设计";
document.bookform.bookpublisher.value="电子工业出版社";
document.bookform.bookamount.value="90000";
break;
default : break;
}
}
</script>
<!--
<script>
var books=new Array();
books[0]=new book("语文","少年儿童出版社",10000);
books[1]=new book("数学","高教育出版社",120000);
books[2]=new book("计算机基础","清华出版社",50000);
books[3]=new book("WEB程序设计","电子工业出版",90000);
</script>
-->
<h2 align=center>共有四本书可查看</h2>
<form name="bookform">
选中当前显示的书:<input type=button value='A书' onclick="updateinfo('a')" >
<input type=button value="B书" onclick="updateinfo('b')">
<input type=button value="C书" onclick="updateinfo('c')">
<input type=button value="D书" onclick="updateinfo('d')"><br><br>
当前名:<input type="text" value="A书" name="currbook"><br><br>
书名 : <input type="text" value="语文" name="booktitle"><br><br>
出版社:<input type="text" value="少年儿童出版社" name="bookpublisher"><br><br>
印数 : <input type="text" value="10000" name="bookamount">
</form>
</body>
</html>
谢谢,但能帮我找找我写的程序出错的原因吗?