首页产品库评测行情新闻|手机数码笔记本台式机DIY硬件数字家庭数码相机办公外设|软件下载游戏开发|社区

更多

数码相机
MP4
LCD
机箱
音箱

软件资讯设计 工具 系统 开发 安全 办公 陶吧 IT教育 Windows 7 | 下载中心天极下载中心诚征下载通路合作伙伴
天极网 > 软件频道 > 网页陶吧>编辑推荐:最新 javascript 技巧集

编辑推荐:最新 javascript 技巧集

2006-12-27 08:48作者:龙犊出处:盛世唐朝责任编辑:龙犊

  

  //使用数据岛

  
  <html>
  <body>
  srno:<input type=text datasrc=#xmldate DataFLD=srno size="76"><BR>
  times:<input type=text datasrc=#xmldate DataFLD=times size="76"><BR>
  <input id="first" TYPE=button value="<< 第一条记录" onclick="xmldate.recordset.moveFirst()">
  <input id="prev" TYPE=button value="<上一条记录" onclick="xmldate.recordset.movePrevious()">  
  <input id="next" TYPE=button value="下一条记录>" onclick="xmldate.recordset.moveNext()">  
  <input id="last" TYPE=button value="最后一条记录>>" onclick="xmldate.recordset.moveLast()">   
  <input id="Add" TYPE=button value="添加新记录" onclick="xmldate.recordset.addNew()">  

  <XML ID="xmldate">
  <infolist>
  <info ><srno>20041025-01</srno><times>null</times></info>
  <info ><srno>20041101-09</srno><times>2004年10月1日2点22分0秒</times></info>
  </infolist>
  </XML>
  </body>
  </html>
  //获得参数

  <body>
  <a href="javascript:location.href=location.href + '?a=1&b=2'">search</a>
  <script language="JavaScript">
  <!--
  var a = location.search.substr(1);
  if(a.length>0)
  {
   var re = /([^&]*?)\=([^&]*)/g
   var s = a.match(re);
   for(var i= 0;i<s.length;i++)
   {
    alert(s[i]);
    alert(s[i].split("=")[1]);
   }
  }
  //-->
  </script>
  </body>
  //可编辑SELECT

  <input type=text name=re_name style="width:100px;height:21px;font-size:10pt;"><span style="width:18px;border:0px solid red;"><select name="r00" style="margin-left:-100px;width:118px; background-color:#FFEEEE;" onChange="document.all.re_name.value=this.value;">
                  <option value="1">11111111<option>
                  <option value="2">222222</option>
                  <option value="3">333333</option>
                </select>
                </span>

   

  //设置光标位置

  
  function getCaret(textbox)
  {
   var control = document.activeElement;
   textbox.focus();
   var rang = document.selection.createRange();
    rang.setEndPoint("StartToStart",textbox.createTextRange())
   control.focus();
   return rang.text.length;
  }
  function setCaret(textbox,pos)
  {
   try
   {
    var r =textbox.createTextRange();
     r.moveStart('character',pos);
     r.collapse(true);
     r.select();
   }
   catch(e)
   {}
  }
  function selectLength(textbox,start,len)
  {
   try
   {
    var r =textbox.createTextRange();
   
    r.moveEnd('character',len-(textbox.value.length-start));
    r.moveStart('character',start);
    
    r.select();
   }
   catch(e)
   {//alert(e.description)}
  }
  function insertAtCaret(textbox,text)
  {
   textbox.focus();
   document.selection.createRange().text = text;
  }
   热卖推荐: 手机 诺基亚 MP5 电脑包 双卡双待 手机链 U盘 笔记本电脑

关注此文的读者还看过:

返回网页陶吧首页

软件频道最新更新

热点推荐

IT嘉年华

编辑推荐

软件下载

热门
推荐

网友关注

软件
资料
游戏

装机推荐

文章排行

本周
本月
最新更新
天极服务|关于我们|About us|网站律师|RSS订阅|友情合作|加入我们|天极动态|网站地图|意见反馈|MSN/QQ上看天极
Copyright (C) 1999-2012 Yesky.com, All Rights Reserved 版权所有 天极网络