<%@ Page Language="C#" AutoEventWireup="true" CodeFile="myjavascript.aspx.cs" Inherits="myjavascript" %><!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 runat="server">
<title></title>
<script type="text/javascript"> var theDayElement = window.document.form1.theDay;/////错误: 'window.document.form1.theDay' 为空或不是对象
document.write("Theree are" + theDayElement.length + "options<br>");
var optionCounter;
for (optionCounter = 0; optionCounter < theDayElement.length; optionCounter++) {
document.write("Option text is" + theDayElement.options[optionCounter].text)
document.write(" and its value is ");
document.write(theDayElement.options[optionCounter].value);
document.write("<br>")
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
<head runat="server">
<title></title>
<script type="text/javascript"> var theDayElement = window.document.form1.theDay;/////错误: 'window.document.form1.theDay' 为空或不是对象
document.write("Theree are" + theDayElement.length + "options<br>");
var optionCounter;
for (optionCounter = 0; optionCounter < theDayElement.length; optionCounter++) {
document.write("Option text is" + theDayElement.options[optionCounter].text)
document.write(" and its value is ");
document.write(theDayElement.options[optionCounter].value);
document.write("<br>")
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
解决方案 »
- 如何去掉重复的br 第二版
- jsp中java二维数组传递给JS二维数组的问题~
- 一个小问题,事件绑定
- 请问javascript的返回值可不可以被在value中被调用?具体如下:
- ExtJs 3.4版本 treepanel 异步加载 5000个节点 界面卡死
- display=none在firefox下的bug.
- JS向JSP中传递变量的方法,在JSP里用变量来接受JS中的那个变量?十万火急!
- iframe中的js想调用外部frame的js方法,可以吗?怎么实现?
- onestab(┼─) ,runmin(*^_^*) 进来领分!
- 如何使用js获取开机用户名?
- input type="file" 这个控件的点击事件是什么?有办法在点击其他控件时触发么?
- innerhtml 返回对象如何获取其中组件
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="myjavascript.aspx.cs" Inherits="myjavascript" %><!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 runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
<script type="text/javascript"> var theDayElement = window.document.form1.theDay;
document.write("Theree are" + theDayElement.length + "options<br>");
var optionCounter;
for (optionCounter = 0; optionCounter < theDayElement.length; optionCounter++) {
document.write("Option text is" + theDayElement.options[optionCounter].text)
document.write(" and its value is ");
document.write(theDayElement.options[optionCounter].value);
document.write("<br>")
}
</script>
window.onload = function(){
var theDay = document.getElementById("theDay");
}这样比较好 。