<html>
<head>
<title> New Document </title>
<script>
function func(dd){
alert(dd);
}
</script>
</head>
<body>
<input name="ddd" type="hidden" value="123qwe">
<input type="button" value="submit" οnclick="func(ddd.value)">
</body>
<head>
<title> New Document </title>
<script>
function func(dd){
alert(dd);
}
</script>
</head>
<body>
<input name="ddd" type="hidden" value="123qwe">
<input type="button" value="submit" οnclick="func(ddd.value)">
</body>
</html>
第二个例子
<body>
<input id="ddd" name="ddd" type="hidden" value="123qwe">
</body>
<script>
window.onload =s();
function s()
{
alert(document.getElementById("ddd").value);
}
</script>
第三个例子
<body> <p id="ss">内容</p> <input type="button" name="Submit" value="显示" οnclick="s()" /> </body> <script> function s() { alert(document.getElementById("ss").innerHTML); } </script>