欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

HTML頁(yè)面跳轉(zhuǎn)及參數(shù)傳遞問(wèn)題

  發(fā)布時(shí)間:2017-12-05 17:26:53   作者:愛(ài)曬太陽(yáng)的風(fēng)   我要評(píng)論
這篇文章給大家詳細(xì)介紹了HTML頁(yè)面跳轉(zhuǎn)及參數(shù)傳遞問(wèn)題,需要的朋友參考下吧

HTML頁(yè)面跳轉(zhuǎn):

window.open(url, "", "width=600,height=400");

第二個(gè)參數(shù):_self,在當(dāng)前窗口打開窗口;_blank(默認(rèn)值),在另外的新建窗口打開新窗口;

window.location.href="http://www.dbjr.com.cn";     //在同當(dāng)前窗口中打開窗口
window.history.back(-1);    //返回上一頁(yè)面
 <a href="http://www.baidu.net"  target="_blank">

HTML參數(shù)傳遞:

1. url傳參:

第一個(gè)頁(yè)面(a.html):

var obj = a.value; //傳給彈出頁(yè)面參數(shù)
var url = 'jxb.html?obj='+obj;
url = encodeURI(url);
window.open(url, "", "width=600,height=400");

第二個(gè)頁(yè)面(b.html):

var url = decodeURI(window.location.href);
var argsIndex = url .split("?obj=");
var arg = argsIndex[1];

注:中文傳輸:可以在頁(yè)面a用encodeURI 編碼url  在b頁(yè)面用decodeURI解碼url

2. cookie傳參:

function setCookie(cname,cvalue){
    document.cookie = cname + "=" + cvalue;
}
function getCookie(cname){
    var name = cname + "=";
    var ca = document.cookie;
}

3. localStorage對(duì)象傳參:

a.html:

var div = doucment.getElementById('要獲取字符串的DIV ID名');
localStorage.string = div.textContent;

b.html:

var div = doucment.getElementById('要寫入的DIV ID名');
div.textContent = localStorage.string;

4. window.opener()

父頁(yè)面:

<input type="text" name="textfield" id="textfield"/>
window.open("子頁(yè)面.html");

子頁(yè)面:

window.opener.document.getElementByIdx('textfield').value='123123123';

總結(jié)

以上所述是小編給大家介紹的HTML頁(yè)面跳轉(zhuǎn)及傳遞參數(shù)問(wèn)題,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評(píng)論