啊,知道了...刚开始用JS...感谢提醒
解决方案 »
- 通过window.location提交和form提交有何区别
- 图片滚动在FF上运行占CPU100%
- http://gz.o.cn是用javascript实现的吗?
- IE7对window.open()中windowname的支持
- 请问<iframe>标记问题??
- JavaScript如何检测文本框里是否只是数字?急在线等!
- 高分求救,如何判断用动态方式形成的无数个TEXT框中哪个框的值是否为空?
- 要怎样做才可以使到 tree.jsp 中的 getTreePath 传到 deeptree.css 中去?
- 急:一个<input type=text name=a >中只能录入数据,逗号,大于号,小于号,和等号,如何判断?
- div style设置没有用,求大神解释
- json
- 新手问题:EXT中分页显示
<html>
<head>
<script type="text/javascript">
function myclass(value)
{
this.data=value;
this.next=null;
}
var first=null;
var last=null;
function run()
{
a=new myclass(document.getElementById("txt").value);
if (first==null)
{
first=a;
last=a;
}
else
{
last.next=a;
last=a;
}
document.getElementById("txt").value="";
alert(a.data);
}
function show()
{
for(temp=first;temp!=null;temp=temp.next)
{
alert(temp.data);
}
}
</script>
</head>
<body>
<input type=text width=10 id="txt">
<input type=button value="add" onclick="run()">
<input type=button value="show" onclick="show()">
</body>
</html>
该代码实现点击“add”将text 中的内容加入到链表中。点击“show”将整个链表的内容输出。你可以参考一下,树结构也可以由相似方法实现。