最近在做一个xtree目录树, 需要手工添加节点,用到此方法
<!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 http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>

<script type="text/javascript">
function diag()
{
    var str=prompt("随便写点儿啥吧","比如我叫啥");
    if(str)
    {
        alert("您刚输入的是:"+ str)
    }
}

</script>
<p>
<input type="submit" value="Sumit" name="Su1" onclick="diag()" />
</p>
</body>
</html>



本文转载:CSDN博客