代码如下:
$(function(){
$("#input").focus(function(){//#input换成你的input的id
//这里写获得焦点之后运行的代码。
}).blur(function(){
//$(".scroll-question").css("display","none");
});
})
})
. 代码如下:
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "https://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script src="/js/jquery-1.4.4.js"></script>
<script>
$(document).ready(function()
{
$("#namebefore").dblclick(function()
{
$("#namebefore").replacewith("<p id='namein'><input type='text' name='nameinval' id='nameinval' value='in' /></p>");
}
);
//失去焦点以后
$("#nameinval").live("blur",function()
{
alert('nameinval已失去焦点');
}
);
}
);
</script>
</head>
<body>
<form name="testfm" method="post" action="save.php">
<table>
<tr><td>1</td><td><p id='namebefore'>before</p></td></tr>
</table>
</form>
</body>
</html>
如对本文有疑问, 点击进行留言回复!!
【JavaScript笔记(一)】万丈高楼平地起 - 基本概念篇
轻松解决 org.apache.taglibs.standard.tlv.JstlCoreTLV 困惑
vert实践五——Json?Protocol Buffer?FlatBuffers?
[基于tensorflow的人脸检测] 基于神经网络的人脸检测8——验证训练好的神经网络
网友评论