zoukankan      html  css  js  c++  java
  • 文体框取得焦点并内容全选中

    文体框取得焦点
    <script type="text/javascript">
           
    function ischeck(){
                   
    document.getElementById('title').focus();
            }

    </script>

    </head>
    <body  onload="ischeck()">

    <input type="text" name="title" id="title">

    ///////////////////////////////////////

    内容自动全选
    复制语法贴於表单标签框框内
    onfocus="this.select()()" onmouseover="this.focus()"
    按一下全选
    复制语法贴於表单标签框框内
    onfocus="this.select()()"

    多行<textarea rows="7" name="s1" cols="60" 语法放这里>

    单行<input type="text" name="t1" size="15" 语法放这里>

    ///////////////////////////////////////////////////////////////////////////////////////

    我的应用

    <!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>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>药品查询</title>
    <script src="../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
    <link href="../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
    </head>

    <body onload="ischeck()">


    <form id="form1" name="form1" method="post" action="">
      <span id="sprytextfield1">
     

      <input name="txtstudentname" type="text" id="txtstudentname" value="<?php
      //if (isset($_POST['txtstudentname'])) echo $_POST['txtstudentname'];
      if (isset($_POST['txtstudentname']))
     
        $a=$_POST['txtstudentname'];
       
        else  $a=isset($_GET["ss"]) ? $_GET["ss"]:"";
         
      
      echo $a;
     
     
     
      ?>" onfocus="this.select()"   />
     
     
     
      <input type="submit" name="btnsearch" id="btnsearch" value="查找" onClick="test()"/>
      </span>
    </form>
    <?php
     
     
     //if (isset($_POST['btnsearch'])   ) 
      $action = $HTTP_POST_VARS["btnsearch"];
      // $action = $_REQUEST["btnsearch"];
     $ff=trim($_GET["ss"]);
     
     $sw=trim($_POST['txtstudentname']);
     //if (( ($action="查找")  and  ($ff!=$sw )) or (  ($action="查找")  and  $_GET["page"]<2) )
     

    if ( (($action="查找")  and  ($_GET["page"]<1) ) or ($ff=$sw ) )
     
       {
        // $sw=$_POST['txtstudentname'];
     session_start();//启动session
       $_SESSION['username'] = $sw;
       //$bb = 'btno';
     
       $sql="select ypbm as 编码 ,ypmc as 药品名称,pybm from ypk";
      //$sql=sprintf("%s where tym like '%%%s%%' ",$sql,$_POST['txtstudentname']);
       $sql=sprintf("%s where (ypmc like '%%%s%%') or (pybm like '%%%s%%')",$sql,$sw,$sw);
      //show_result($sql,$student,"搜索结果","368");
     
     //echo $sql;
     $page_size=17;
      pagingclk($PHP_SELF,$sql,$student,$page_size,"分页显示记录集",368,$sw);
     
     
        }
      else
       {
      // $sw=$_GET["swi"];
        //$sw= isset($_GET["ss"]) ? $_GET["ss"]:'';//取得url中ss后的值
      session_start();//启动session
     $sw=print_r($_SESSION['username'],true);

     
      $sql="select ypbm as 编码 ,ypmc as 药品名称 ,pybm from ypk";
      //$sql=sprintf("%s where tym like '%%%s%%' ",$sql,$_POST['txtstudentname']);
       $sql=sprintf("%s where (ypmc like '%%%s%%') or (pybm like '%%%s%%') ",$sql,$sw,$sw);
       //echo $ff,$sw,$sql,"fffffff";
      
       $page_size=17;
     paging($PHP_SELF,$sql,$student,$page_size,"分页显示记录集",368,$sw);
     
      }
     
      ?>
    <script type="text/javascript">
    <!--
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {isRequired:false});
    //-->

    function test()
    { alert('click me!');}
    document.onkeydown=function()
    {  if (event.keyCode == 13)
    {  document.getElementById("btnsearch").click();
         

     }}

         
       
         function ischeck(){
                    document.getElementById('txtstudentname').focus();
            }

       

    </script>
    </body>
    </html>

  • 相关阅读:
    Solaris 11 system package 安装与更新(如:assembler)
    JS实现页面内跳转
    使用Eclipse进行嵌入式软件开发
    Eclipse下C++标准库报错::mbstate_t has not been declared
    嵌入式ARM开发环境搭建
    CCS内存数据转成图片
    RESET
    Android 圆角研究
    Java 重写必须满足的条件
    android 社会化分享集成
  • 原文地址:https://www.cnblogs.com/hssbsw/p/3416082.html
Copyright © 2011-2022 走看看