很多时候需要设置栏目标题不能重复,比如产品库,当然产品不能重复,因为重复的意义不大. 当然也可以直接设置栏目&quo;检测标题重复&quo;,这样一来栏目下就不会重复标题了.但
<script type="text/javascript" src="/e/JsLib/jquery/jquery.js"></script>
<script>
function findtitle(){
tbname=$("#tbname").attr("value");
if(tbname==''){return "";}
baseurl="/e/JsLib/jquery/p_list.php?line=10&tbname="+tbname;
ktitle=$("#title").attr("value");
if(ktitle!=""){
baseurl=baseurl+"&ph=1&title="+ktitle;
}
$.ajax({
type:'get',
dataType:'json',
url:baseurl,
error:function(){},
success:function(msg){
document.getElementById("dsg").style.display='none';
var data=msg.list;
$.each(data, function(i, n){
if($("#title").attr("value")==n.title){
document.getElementById("dsg").style.display='inline';
document.getElementById("title").focus();
}
});
}
});
}
</script>
修改代码:(看着修改哦,别搞错了。 )
<tr><td width='16%' height=25 bgcolor='ffffff'>标题</td><td height="25" valign="middle" bgcolor='ffffff'><input id="title" name="title" type="text" size="30" value="" onblur="findtitle()"> <input id="dsg" style="color:red;padding: 1px;border:1px solid #faa;display:none; width:138px;" value="警告:标题重复不能继续" size="19"></td></tr>
请输入密码后继续:
扫描二维码关注微信公众号
回复星联下载网获取下载密码
本网刊登的文章均仅代表作者个人观点,并不代表本网立场。文中的论述和观点,敬请读者注意判断。
2022-04-12
2021-02-08
2022-05-29
2021-08-29
2022-10-26
2022-05-30
2021-08-27
2021-02-08