導航:首頁 > 編程語言 > 頁面js驗證

頁面js驗證

發布時間:2021-02-25 20:12:57

jsP頁面javascript驗證的問題

你的
System.out.println(name);
System.out.println(pwd);
System.out.println(rpwd);
打出來的值都是正確的嘛?如果是正確的,那你的wwww這個表中是不是只有回name,pwd,rpwd這3個字答段?如果還有其他欄位的話
你的SQL語句最好寫成insert into wwww(name,pwd,rpwd) values('"+name+"','"+pwd+"','"+rpwd+"');
如果還不行的話 那你最好吧錯誤信息帖出來。

② 請問下,在用html編寫一個用戶注冊界面時,怎麼加入js驗證。

在Form中加一個onsubmit事件再在事件中寫驗證代碼

③ js實現頁面提交驗證輸入信息是否為空

1、form 有個onsubmit 事件,<s:form action="add" onsubmit='check();'> 在check方法中可以寫驗證方法,最終如果返回false,那麼表單就不會被內提交容,返回true才會提交到action中

2、onsubmit 事件驗證是點擊提交之後在js本頁面驗證,驗證通過才會提交到action中,如果要想判斷用戶名是否已注冊,則不能通過這種方法了,因為在本頁面是無法判斷你的用戶名是否已經在資料庫中的,要做賬號是否注冊的驗證有兩種方法、
第一種是在輸入用戶名後,用戶名輸入框失去焦點時,使用ajax將用戶名傳遞到後台的驗證方法中進行驗證,然後根據返回結果,進行提示比如alert(),或者在用戶名輸入框後 顯示文字用戶已注冊之類,並且提交驗證中不允許提交、
第二種是將form提交到action中判斷,不能注冊就返回本頁面在進行提示

④ 在表單驗證問題上,到底是用js在頁面做驗證,還是在後台Java程序里驗證呢

本質上說,前台驗證是起不了任何作用的,因為可以用Fiddler、WireShark等HTTP請求專分析軟體攔截並修改請求。
所以數據屬驗證一定要在後台進行。
企業實際系統看你做給誰用了,如果是內部使用並且數據不是非常關鍵(關鍵的數據有哪些呢?如涉及錢的數據都很關鍵,訂單、合同之類)的話,一般前端做做驗證,後台稍作驗證即可。如果數據很關鍵,安全性很關鍵,那麼後端就必須做非常完備的數據驗證,而且還要採取其他一些防範措施來避免(或者確切地說減少可能性)SQL注入、跨站腳本攻擊、CSRF(跨站請求偽造)、緩沖區溢出等等攻擊。

⑤ JS,頁面表單輸入驗證.....

//那我來個js的抄
<scriptLANGUAGE="JavaScript">
functionaa(){
varbb=document.getElementsByTagName("input");//獲取所有襲的input
varflag=1;//標志位,1代表通過
for(vari=0;i<bb.length;i++){//循環
if(bb.type="text"){//如果是文本框
if(bb[i].value==""){//如果是空則結束循環,標志位置0
flag=0;
break;
}
}
}
if(flag==1){//如果標識位是1,則按鈕可用
document.getElementById("bb").disabled=false;
}
}
</script>
<inputtype="text"id="name"onkeyup="aa()">//所有文本框上要添加個事件
<inputtype="text"id="age"onkeyup="aa()">
<inputtype="button"value="aa"onclick=""id="bb"disabled>

⑥ 怎麼JS驗證不了

你的表單名和JS定義的函數名好像和JS內部什麼東西起了沖突
改了就可以了

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!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>找回密碼</title>
<script language="javascript">
function cc()
{

if (document.form1.username.value.length==0)
{
alert("請輸入要查找密碼的用戶名!");
document.form1.username.focus();
return false;
}
if (document.form1.question.value.length==0 )
{
alert("請輸入提示問題!");
document.form1.question.focus();
return false;
}
if (document.form1.answer.value.length==0 )
{
alert("請輸入回答問題!");
document.form1.answer.focus();
return false;
}

}
</script>

</head>

<body style="text-align:center; margin:28px auto 28px auto; background-color:#e3edd2">
<form method="post" name="form1" action="#" >
用戶名稱
<input type="text" maxlength="20" name="username" /><br /><br />
提示問題
<input type="text" maxlength="50" name="question" /><br /><br />
回答問題
<input type="text" maxlength="50" name="answer" /><br /><br />

<input type="submit" value="確定" onclick="return cc();"/>
<input type="reset" value="重填" >

</form>
</body>
</html>

⑦ js頁面輸入驗證碼怎麼進行校驗

<html>
<head>
<script language="javascript" type="text/javascript">
var code ;
function createCode(){
code = new Array();
var codeLength = 4;
var checkCode = document.getElementById("checkCode");
checkCode.value = "";
var selectChar = new Array(2,3,4,5,6,7,8,9,'A','B','C','D','E','F','G','H','J','K','L','M','N','P','Q','R','S','T','U','V','W','X','Y','Z');
for(var i=0;i<codeLength;i++) {
var charIndex = Math.floor(Math.random()*32);
code +=selectChar[charIndex];
}
checkCode.value = code;
}
function validate () {
var inputCode = document.getElementById("yzm").value.toUpperCase();
if(inputCode != code ){
alert("驗證碼錯誤!");
return false;
}
else {
alert("驗證碼正確!");
return true;
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body onLoad="createCode();">
驗證碼:<input type="text" id="yzm" size="5" />
<input type="button" id="checkCode" onClick="createCode()" title="刷新驗證碼" style="width:50px;color:#F00;border:0;letter-spacing:1px;font-family:Arial;" />
<input type="button" id="Button1" onClick="validate();" value="確定" />
</body>
</html>

⑧ js表單驗證 頁面跳轉

<script language="javascript">
//這個很簡單,
function checkSend(oform) {
if (oform.name.value=="") { //名字為空就返回了
alert("收件人不能為空")
oform.name.focus(); //焦點放到內輸入名字的地方容
return false; }
if (oform.subject.value=="") { //主題為空時候
if (!confirm("是否要為空?")) {
oform.subject.focus();
return false;
}
}
return true ;
}
</script>
<form name="oform" action="2.html" onsubmit="return checkSend(this);">
收件人:<input type="text" name="name" value=""></br>
主 題:<input type="text" name="subject" value=""></br>
<input type="submit" name="send" value="發送">
</form>

⑨ css頁面布局 , js驗證

內部沒有抄居中 是你襲內部設置了float:left;的原因
如果取消這個,也會有寬度無法定製的問題。
jquery
var href=$('a').attr('href');
if(href=='###'){alert();}else{location.href=""}

⑩ 尋求頁面js的驗證方法 謝謝

<html>
<head>
<meta http-equiv=content-type content="text/html;charset=GBK">
<script>
<!--
// 改變input的titile屬性
function func(obj){
// 這里只寫了修改maxvalue, minvalue的也是一樣的改法,按你自己的需求改吧
var txts = document.getElementsByName("maxvalue");
if(txts)
txts[0].title = "current value " + obj.options[obj.selectedIndex].value;
}
-->
</script>
</head>
<body>
<table>
<tr>
<td><input type="text" name="id" ></td>
<td>
<select name="name" onchange="func(this)">
<option id="aa" value="1">aa</option>
<option id="bb" value="2">bb</option>
</select>
</td>
<td>
<input type="text" name="maxvalue" title="this is maxvalue title">
</td>
<td>
<input type="text" name="minvalue" title="this is minvalue title">
</td>
</tr>
</table>
</body>
</html>

閱讀全文

與頁面js驗證相關的資料

熱點內容
工業機器人示教編程是指什麼 瀏覽:566
在線能看的資源電影 瀏覽:308
734什麼錯誤代碼 瀏覽:220
淘寶傳文件軟體 瀏覽:310
韓國電影國語發音 瀏覽:423
第365章天資榜葉凌天 瀏覽:864
大胸乳房電影 瀏覽:200
開網路醫院需要什麼手續 瀏覽:595
2014世界500強word 瀏覽:867
羅蘭曾志偉主演鬼電影全集 瀏覽:961
jsregexpmatch替換 瀏覽:848
飛盧小說vip章節破解方法 瀏覽:497
主角叫陳凡外號屠夫 瀏覽:305
列印文件隱藏軟體 瀏覽:431
js中時分秒正則表達式 瀏覽:569
excel文件查看器 瀏覽:718
電影理發師殺死女友 瀏覽:419
word2003剪貼板 瀏覽:208
手機微信文件已過期或已被清理怎麼辦 瀏覽:997
免費看會員電影網站 瀏覽:639

友情鏈接