62,046
社区成员
发帖
与我相关
我的任务
分享
$.fn.inputchange = function(func) {
var typeName = this.attr("type");
if (typeName)
typeName = typeName.toLowerCase();
if ("text" == typeName) {
if ($.browser.msie) {
this[0].attachEvent("onpropertychange", func, false);
} else {
this[0].addEventListener("input", func, false);
}
}
}
$("#txt").inputchange(function(){
})
<script type='text/javascript'>
function txtBlur(el)
{
//
}
</script>
<input type='text' runat='server' value='' onBlur='javascript:txtBlur(this)'>
<script type='text/javascript'>
function txtChange(el)
{
//
}
</script>
<input type='text' runat='server' value='' onChange='javascript:txtChange(this)'>
<!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>在这里看maopian</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#username").focus(function () {
$(this).attr({ style: "border-color:#FFA91A;" });
if ($(this).val() == "请输入maopian网址")
$(this).attr("value", "");
$(this).attr({ style: "color:#653C31;" });
});
$("#username").blur(function () {
$(this).attr({ style: "border-color:#c1c1c1;" });
if ($(this).val() == "") {
$(this).attr("value", "请输入maopian网址");
} else {
$(this).attr({ style: "color:#653C31;" });
}
});
});
</script>
</head>
<body>
<input id="username" class="input_name" value="请输入maopian网址" runat="server" />
</body>
</html>
<script type="text/javascript">
$(function () {
$('#txtIDCardNumber').change(function () {
$('#hdIDCardNumber').val($(this).val());
})
})
</script>
<asp:TextBox ID="txtIDCardNumber" runat="server" Width="250px" ClientIDMode="Static"></asp:TextBox>
<asp:TextBox ID="hdIDCardNumber" runat="server" ClientIDMode="Static" CssClass="isshow"></asp:TextBox>
var xmlhttp;
function loadXMLDoc(url, cfunc) {
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
}
else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = cfunc;
xmlhttp.open("GET", url, true);
xmlhttp.send();
}
function showHint(str) {
loadXMLDoc("search.aspx?n=" + str, function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
try {
document.getElementById("hint").innerHTML = xmlhttp.responseText;
} catch (e) {
alert(e);
}
}
});
}
<input type="text" id="txtSearch" onkeyup="showHint(this.value)" />
<p>建议:<span id="hint"></span></p>