JQuery第一次写的JQuery(查询改变文本框属性源代码)

来源:互联网 发布:115网盘淘宝暗号 编辑:程序博客网 时间:2024/06/11 05:56

0.jQue弹框样式页面: http://www.jscode.cn/js/demo/16562/ http://blog.csdn.net/w809026418/article/category/656467?viewmode=list

<script>
//window.onload=function(){};当页面内容完全加载完成时执行,内容过多如图片会给用户造成看不见效果的问题
//$(document).ready(function(e) {});当DOM文档加载完成时执行
$(document).ready(function(e) {
 //当单击查询时使其保持以前的状态调用函数
 selectCxtj();
 //当改变gm_cxtj中的内容改变相应的查询条件
 $('#gm_cxtj').bind('change',selectCxtj);
 
    //$('#gm_cxtj').bind('change',{zhi:'$(this).val()'},selectCxtj);传送参数,该方法有点问题
});

function selectCxtj(){
     //公共函数不用var zhi=$(this).val();
     var zhi=$('#gm_cxtj').val();
  if(zhi=="申请时间"){
     //当select选项为'申请时间'给input添加onClick事件和value值
    $('#gm_query').attr({"onClick":"WdatePicker()","value":"<%=Date()%>","readonly":"readonly"});
   }else{
     $('#gm_query').removeAttr("onClick");
     $('#gm_query').removeAttr("value");
     $('#gm_query').removeAttr("readonly");
   };
  if(zhi=="状态"){
     $('#ipgm_gc').removeAttr("style");
     $('#ipgm_query').attr({"style":"display:none"});    
   }else{
     $('#ipgm_query').removeAttr("style");
     $('#ipgm_gc').attr({"style":"display:none"});    
   };
 };
</script>

------------------Html页面内容

<body>
<%
Response.Buffer = True
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "No-Cache"
%>

<%'查询更名类型 
       '格式化日期与数据库中的日期对应
       gm_query=year(gm_query)&"-"&right("00"&month(gm_query),2)&"-"&right("00"&day(gm_query),2)
       gm_sql="and CONVERT(VARCHAR(10),gm_time,121)='"&gm_query&"' "
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="title">
  <tr>
    <td width="552" class="title2">域名更名记录</td>
    <form class="form" method="get">
    <td><font style="font-weight:bold;">按类查询:</font>
        <input name="gm_lei" type="radio" value="" checked="checked" />全部
        <input name="gm_lei" type="radio" value="1" <%if gm_lei="1" then%>checked="checked" <%end if%>/>名称
        <input name="gm_lei" type="radio" value="2" <%if gm_lei="2" then%>checked="checked" <%end if%>/>域名
    </td>
    <td><font style="font-weight:bold;">查询条件:</font>              
                <select id="gm_cxtj" name="gm_cxtj"><option value="客户ID" <%if gm_cxtj="客户ID" then%>selected="selected"<%end if%>>客户ID</option>
                        <option value="原名称" <%if gm_cxtj="原名称" then%>selected="selected"<%end if%>>原名称</option>
                        <option value="新名称" <%if gm_cxtj="新名称" then%>selected="selected"<%end if%>>新名称</option>
                        <option value="申请时间" <%if gm_cxtj="申请时间" then%>selected="selected"<%end if%>>申请时间</option>
                        <option value="状态" <%if gm_cxtj="状态" then%>selected="selected"<%end if%>>状态</option>
                </select>               
                 <span id="ipgm_query"><input id="gm_query" name="gm_query" type="text"/></span>
                 <span id="ipgm_gc" style="display:none">
                 <input name="gm_gc" type="radio" value="已取消" checked="checked" /><font color="#FF0000">已取消</font>
                 <input name="gm_gc" type="radio" value="审核中" <%if gm_gc="审核中" then%>checked="checked" <%end if%>/><font color="#333399">审核中</font>
                 <input name="gm_gc" type="radio" value="已完成 " <%if gm_gc="已完成" then%>checked="checked" <%end if%>/><font color="#009966">已完成</font>
                 </span>          
                <input type="submit" value="查询"/>
     </td>
     </form>                  
  </tr>
</table>

</body>