0
<HTML>
<HEAD>
<TITLE>Test Input</TITLE>
<script type="text/javascript">
function go (form) {
  var Tid = document.upperform.inputbox.value;
  alert ("You typed: " + Tid);
    //window.location.href = 'http://serverpage=' + Tid + '&tab=0';
</script>

</HEAD>
<BODY>
<FORM NAME="upperform" ACTION="" METHOD="GET">Go to this Task ID:
    <INPUT TYPE="text" NAME="inputbox" VALUE="" OnBlur="validate(this.form)">
    <INPUT TYPE="button" NAME="button" Value=" Go " onClick="go(this.form)">
</FORM>
</BODY>
</HTML>

我不能让它工作。看起来它应该可以工作,但我一定错过了一些东西。有什么建议么?

4

2 回答 2

0

您的函数缺少一个结束括号。除此之外,代码有效:http: //jsfiddle.net/45paz/

function go (form) {
  var Tid = document.upperform.inputbox.value;
  alert ("You typed: " + Tid);
}
于 2012-12-05T20:02:27.957 回答
0

缺少右括号

<script type="text/javascript">
function go (form) {
  var Tid = document.upperform.inputbox.value;
  alert ("You typed: " + Tid);
    //window.location.href = 'http://serverpage=' + Tid + '&tab=0';
}// <- missing bracket
</script>
于 2012-12-05T20:02:40.840 回答