【发布时间】:2014-02-20 15:12:02
【问题描述】:
<body bgcolor="white">
<!--Add your controls here-->
<table cellspacing=1 cellpadding=3 bgcolor="black">
<tr>
<td bgcolor="white">
<script type="text/vbscript">
document.write(userName)
window.Alert(userName)
</script>
</td>
<td bgcolor="white">row1_col2</td>
</tr>
<tr>
<td bgcolor="white">row2_col1</td>
<td bgcolor="white">row2_col2</td>
</tr>
<tr>
<td bgcolor="white">row3_col1</td>
<td bgcolor="white">row3_col2</td>
</tr>
</table>
<!--{{InsertControlsHere}}-Do not remove this line-->
</body>
</html>
用户名仅出现在 HTML 上方的标签中。当我使用 window.Alert userName 时,该值会显示,但前提是该代码在上面的部分中。当我在正文中执行相同的 window.Alert 时,我得到“”(空字符串)。
我不知道发生了什么。我根据其中一个 cmets 的建议更新了代码。
【问题讨论】:
-
我没有使用模板。我没有意识到 是专门用于 ASP 的。我有一些有限的 ASP 背景,并假设