導航:首頁 > 編程語言 > js確認信息後跳轉

js確認信息後跳轉

發布時間:2023-02-25 16:46:49

js跳轉到$url

$url是PHP中的變數嗎?如果是,就這樣:
window.location.href="<?php echo $url; ?>";
如果是js本身的變數,版則權這樣:
window.location.href=$url;

⑵ JS表單驗證,按鈕驗證,驗證成功怎麼實現跳轉

<form action="reg.html" name="loginForm" id="login" onsubmit="retrun checkdata()">

return寫錯了,應該是return,你寫的是retrun。檢查一下……

另外把
if(checkName()==false)
return false;
else
return true;
if(checkPassword()==false)
return false;
else
return true;
改成

if(checkName()==false)
return false;
if(checkPassword()==false)
return false;
else
return true;

⑶ 如何讓我點擊了alert的確定之後,再跳轉頁面

步驟:

  1. 在用抄layer的組件的時候,有時候你需要加上一個parent.location.href跳轉頁面,就不會再層裡面跳轉了。

  2. 記得把「submit」換成「button」

  3. 代碼如下:

⑷ JS 網頁彈出對話框,可以自定義一段文字,點擊"確定"後轉到指定網頁,點擊"取消"直接關閉網頁

不用定義方法function,直接這樣寫

<script type="text/javascript">

if(confirm("確認?")){
location.href="a.jsp";
}else{
window.close();
}

</script>

那個a.jsp你可以隨便改,想跳哪就跳哪。

給採納呀哥們!

⑸ 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>

⑹ js判斷是否登錄並跳轉頁面

具體如下:
1.使用session存儲,確定用戶是否登錄,從而確定頁面跳轉至哪個頁面。
判斷本地有無customerID:

function jumpTo(p, url) {
var customerId=sessionStorage.customerId;
if (customerId == undefined) {
p.attr("href", "page/Login/login.html");
<span style="white-space:pre"> </span>} else {
p.attr("href", url);
}
}
function infoJumpTo() {
var $info = $("#info");
jumpTo($info, "");
}
function starJumpTo() {
var $star = $("#star");
jumpTo($star, "");
}

html中,相應的a標簽中,寫onclick="infoJumpTo"等就可以。
2.但登錄頁面的customerID存儲到本地的session中

function confirm(){
var tel=$tel.val();//獲取頁面中登錄名和密碼
var pwd=$pwd.val();
if(tel==""|| pwd==""){//判斷兩個均不為空(其他判斷規則在其輸入時已經判斷)
alert("手機號密碼均不能為空!")
return false;
}else{//以上均符合要求,則調用登錄esb介面
$.ajax({
url:config.baseServerUrl + '/account/login',//相對應的esb介面地址
type:'post',
data:{mobile:tel,password:pwd},//向伺服器(介面)傳遞的參數
success:function(data){//伺服器(介面)返回來的數據
if(data.success){//如果返回來的信息說明提交的信息為正確的
var customerId = data.attr.customerInfo.id;//將數據中用戶信息的ID賦值給變數
sessionStorage.customerId = customerId;//將變數存儲到本地sessionStorage中,並且value為customerID
window.location.href='';//正確登錄後頁面跳轉至
}
else{//如果返回來的信息說明提供的信息為錯誤的
if(tel != data.tel){//判斷是用戶名還是密碼錯誤,提示相應信息
alert(data.message);
$tel.val("");
$pwd.val("");
return false;
}
if(pwd != data.pwd){
alert(data.message);
$pwd.val("");
return false;
}
}
}
})
}
}

3.登錄頁面,人們一般習慣輸完信息後,直接點擊enter免除手動點擊登錄按鈕,則js代碼如下:

//判斷是否敲擊了Enter鍵
$(document).keyup(function(event){
if(event.keyCode ==13){
$("#login").trigger("click");
}
});

⑺ JSconfirm 提示框內跳轉問題

給大家介紹幾種比較常見的js實現頁面跳轉的方式

第一種:

<script language="javascript" type="text/javascript">
window.location.href="login.jsp?backurl="+window.location.href;
</script>

第二版種:

<script language="javascript">
alert("返回權");
window.history.back(-1);
</script>

第三種:

<script language="javascript">
window.navigate("top.jsp");
</script>

閱讀全文

與js確認信息後跳轉相關的資料

熱點內容
u盤驅動在哪個文件夾里 瀏覽:938
華為手機跟蘋果手機怎麼克隆app 瀏覽:172
cad文件為什麼顯示文件名是否正確 瀏覽:174
程序配置文件能自動轉換成txt 瀏覽:985
r4燒錄卡不同版本 瀏覽:962
怎麼升級qq群為2000 瀏覽:347
微信己冊除的文件怎樣找回來 瀏覽:715
蘋果美國賬號共享2017 瀏覽:252
ps文件修改後打開還是原圖 瀏覽:220
燒卡機蘋果4微信qq哪裡下載 瀏覽:780
ug120找不到指定文件 瀏覽:522
cda文件怎麼轉換成mp3格式 瀏覽:702
青島hpv疫苗在哪個app預約 瀏覽:881
雙十一成交額2021數據在哪裡看 瀏覽:631
蘋果手機怎麼打開移動數據 瀏覽:637
文件掃描成圖片是彩色的嗎 瀏覽:50
編程里的comply什麼意思 瀏覽:91
電腦上面點了禁用網路怎麼改回來 瀏覽:28
javacatch執行 瀏覽:182
ps軟體文件名字 瀏覽:184

友情鏈接