<script>for(i=2000;i<=2010;i++)document.write("<option //这个地方的语法应该是怎样的if i=rs("year") then response.write "selected" end if好像不行// >"+i+"</option>")</script>
可以写为:
<script>
for(i=2000;i<=2010;i++){
   document.write("<option");
   if(i == rs("year")
      document.write("selected");
   document.wirte(">" + i + "</option>");
}
</script>

解决方案 »

  1.   

    那日呢,又是怎么比较,我对JAVASCRIPT基础很差
      

  2.   

    <select name=year onchange=toDate()>
    <script>for(i=2000;i<=2010;i++)document.write("<option "+(i!=<%=rs("year")%>?">":"selected>")+i+"</option>")</script>
    </select>
      

  3.   

    判断天: for( i =0 ; i<day.options.length; i++){ if(day.options[i].value == rs.("day")){
    day.options[i].selected = true;;
    }

    }
      

  4.   

    比如2002-8-15
    <form>
    <select name=year onchange=toDate()>
    <script>for(i=2000;i<=2010;i++)document.write("<option>"+i+"</option>")</script>
    </select>
    <select name=month onchange=toDate()>
    <script>for(i=1;i<=12;i++)document.write("<option>"+i+"</option>")</script>
    </select>
    <select name=day onchange=toDay()></select>
    <input name=weekday>
    </form>
    <script>
    var arr="日一二三四五六".split("")function toDate(){
    with(document.all){
    vYear=parseInt(year.options[year.selectedIndex].text)
    vMonth=parseInt(month.options[month.selectedIndex].text)
    day.length=0;
    for(i=0;i<(new Date(vYear,vMonth,0)).getDate();i++){
    day.options[day.length++].value=day.length;day.options[day.length-1].text=day.length;
    }
    }
    toDay();
    }function toDay(){
    vDay=parseInt(document.all.day.options[document.all.day.selectedIndex].value)
    document.all("weekday").value="星期"+arr[new Date(vYear,vMonth-1,vDay).getDay()]
    }function init(y,m,d){
    with(document.all.year)selectedIndex=y-options[0].text
    with(document.all.month)selectedIndex=m-options[0].text
    toDate();
    with(document.all.day)selectedIndex=d-options[0].text
    toDay();
    }
    init(2002,8,15)
    </script>
      

  5.   

    请问,<select name=year onchange=toDate()>
    <script>for(i=2000;i<=2010;i++)document.write("<option "+(i!=<%=rs("year")%>?">":"selected>")+i+"</option>")</script>
    </select>
    ?和:分别代表什么
      

  6.   

    翻译过来就是
    if(i!= <%re("year")%>)
        return ">";
    else
        reutrn "selected>";
      

  7.   

    JScript 也支持隐式的条件格式。该格式在要测试的条件后使用一个问号(而不是在条件前的 if )。它也指定两个可选项,一个在满足条件时使用,另一个在条件不满足时使用。这两个选择项之间必须用一个冒号隔开。var hours = "";// 下面的代码指定 hours 是包含 theHour 的内容,
    // 还是包含 theHour - 12 的内容。hours += (theHour >= 12) ? " PM" : " AM";