如下所示 :
代码
<input id="txt_title" runat="server" name="txt_title" style="width:150px; height:20px" maxlength="40" type="text" onchange="CheckResume('ctl00_head_txt_title','title');"
onkeyup="CheckResume('ctl00_head_txt_title','title')" /><span id="title"></span>(<span
style="color: #CC0000">*</span>标题不能为空)
实际的js如下所示
代码
function CheckResume(_obj1, _obj2) {
//alert(document.getElementById(_obj1).value);
if (document.getElementById(_obj1).value == "") {
document.getElementById(_obj2).innerHTML = "<img src='images/f.gif' />";
return false;
}
else {
document.getElementById(_obj2).innerHTML = "<img src='images/t.gif' />";
return true;
}
}
实际的调用如下所示
代码
<input id="txt_title" runat="server" name="txt_title" style="width:150px; height:20px" maxlength="40" type="text" onchange="CheckResume('ctl00_head_txt_title','title');"
onkeyup="CheckResume('ctl00_head_txt_title','title')" /><span id="title"></span>