wudi

博客园 首页 新随笔 联系 订阅 管理

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<style type="text/css" media="screen">
  body { font: .9em/1.5 "Lucida Grande", "Trebuchet MS", "Bitstream Vera Sans", Verdana, Helvetica, sans-serif; }
  form { width: 20em; margin: 4em auto; }
  dt { clear: left; float: left; }
  dd { clear: right; margin-left: 6em; }
  input, textarea { width: 12em; border: 1px solid #ccc; }
  input:focus, textarea:focus { border: 1px solid #f00; background: #fcc; }
  .ie_hover { background: #ffc; }
  .ie_focus { border: 1px solid #f00; background: #fcc; }
</style>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
    <script type="text/javascript" src="jquery-1[1].2.1.js"></script>
</head>


<script language="javascript">
$(document).ready(function(){
 if ($.browser.msie){
//  $("input[@type='text'], input[@type='password'], textarea").focus(function(){$(this).addClass("ie_focus")}).blur(function(){$(this).removeClass("ie_focus")});
  
  $("#name").focus(function(){$(this).addClass("ie_focus")}).blur(function(){$(this).removeClass("ie_focus")});
  $("#name").focus(function(){$(this).addClass("ie_focus")}).blur(function(){name=$("#name").val();alert(name);});

 $("#username").focus(function(){$(this).addClass("ie_focus")}).blur(function(){n = $("#<%= username.ClientID %>")[0]; alert(n.value);});//服务器端控件元素
 }
})
</script>

<body>
 <form runat="server">
  <dl>
   <dt>Name: <dt>
   <dd><input type="text" id="name"/></dd>
        <asp:TextBox ID="username" runat="server"></asp:TextBox>
                

   <dt>Password: <dt>
   <dd><input type="password" id="password"/></dd>
   <dt>Textarea: <dt>
   <dd><textarea id="content"></textarea></dd>
  </dl>
 </form>
</body>
</html>

posted on 2008-03-27 14:25  菜鸟吴迪  阅读(2771)  评论(1编辑  收藏  举报