日期:2014-05-19  浏览次数:20454 次

Asp.net页面中javascript不起作用
<%@   Page   Language= "C# "   AutoEventWireup= "true "   CodeFile= "SignUpTwo.aspx.cs "   Inherits= "Profile_SignUpTwo "   %>

<!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   class= "Input ">   <select   id= "bYear "   name= "bYear "> </select> <!--

--> <select   id= "bDay "   name= "bDay "> </select> <!--
-->

<select   id= "bMonth "   name= "bMonth "> </select> <!--
-->
<script   type= "text/javascript ">
function   selMosb(pid,pval){
var   h=document.getElementById(pid);
var   m=   new   Array( '一月 ', '二月 ', '三月 ', '四月 ', '五月 ', '六月 ', '七月 ', '八月 ', '九月 ', '十月 ', '十一月 ', '十二月 ');
for(var   i=1;   i   <=   12;i++)
h.options[h.options.length]=new   Option(m[i-1],i);
h.value=pval;
}
function   selRngb(pid,pval,pstart,pend){
var   h=document.getElementById(pid);
if   (pend <pstart)   {
for(var   i=pstart;   i> =pend;   i--)
h.options[h.options.length]=new   Option(i,i);
}
else
{
for(var   i=pstart;i <=pend;   i++)
h.options[h.options.length]=new   Option(i,i);
}
h.value=pval;
}//   addStuff

function   selAddBlnkb(pid,pidx){
var   l=   new   Array( '年 ', '月 ', '日 ');
var   h=document.getElementById(pid);
h.options[h.options.length]=new   Option(l[pidx],0);
}
selAddBlnkb(   "bYear ",0);
selAddBlnkb(   "bMonth ",1   );
selAddBlnkb(   "bDay ",2);

selMosb(   "bMonth ",   0   );
selRngb(   "bDay ",   0,   1,   31   );
selRngb(   "bYear ",   0,   2007,   1907   );
</script>
</div>
        </form>
</body>
</html>


------解决方案--------------------
刚才试了下 没问题啊

<%@ Page Language= "C# " AutoEventWireup= "true " CodeFile= "testjs.aspx.cs " Inherits= "testjs " %>

<!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 id= "Head1 " runat= "server ">
<title> 无标题页 </title>
</head>
<body>
<form id= "form1 " runat= "server ">

<div class= "Input "> <select id= "bYear &qu