代码如下 | 复制代码 |
<tr> <td align="center" bgcolor="#f6f6f6">新闻标题:</td> <td height="25" colspan="2" align="left" bgcolor="#f6f6f6" style="width: 367px"> <input name="title" id="title" onblur="startrequestusingpost();" type="text"/> <label id="message" style="color: red">该标题已存在</label> <label id="lbltitle" style="color: red">标题不能为空</label> </td> <td bgcolor="#f6f6f6"> 不能为空</td> </tr> |
代码如下 | 复制代码 |
<script language="网页特效"> function startrequestusingpost() { if(checktitle()==false) { return; } var title = document.getelementbyid("title").value; createxmlhttprequest(); xmlhttp.open("post","checkntype",true); xmlhttp.onreadystatechange = processresponse; xmlhttp.setrequestheader("content-type","application/x-www-form-urlencoded"); xmlhttp.send("title=" + title); } function processresponse() { if(xmlhttp.readystate == 4) { if(xmlhttp.status == 200) { var result = xmlhttp.responsetext; if(result==1){ document.getelementbyid("message").style.display="inline"; document.getelementbyid("btnadd").disabled="disabled"; }else { document.getelementbyid("message").style.display="none"; document.getelementbyid("btnadd").disabled=""; } } } } function checktitle() { var title=document.getelementbyid("title").value; if(title=="") { document.getelementbyid("lbltitle").style.display="inline"; return false; }else { document.getelementbyid("lbltitle").style.display="none"; return true; } } </script> |
php代码
代码如下 | 复制代码 |
<? $title = $_post['title']; if( $title ='www.111cn.net') { echo 1; } else { echo 0; } ?> |
时间: 2024-11-09 00:04:37