第一、簡單介紹一下location屬性、用法以及相 " /> 国产传媒麻豆剧精品AV,成人免费一级毛片在线播放视频,国产成人精品一区二区三区视频

天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

javascript中的location用法簡單介紹

先前寫了一片用window.location.href實現刷新另個框架頁面 ,特此我看了一下locaiton的詳細用法,對此有點改進,現在我將他整理成js,方便查閱,也貼上和朋友們分享一下,具體如下:

第一、簡單介紹一下location屬性、用法以及相關示例:
Location
包含了關于當前 URL 的信息。

描述
location 對象描述了與一個給定的 Window 對象關聯的完整 URL。location 對象的每個屬性都描述了 URL 的不同特性。
通常情況下,一個 URL 會有下面的格式:

協議//主機:端口/路徑名稱#哈希標識?搜索條件 例如:

http://skylaugh.cnblogs.com/index.html#topic1?x=7&y=2 這些部分是滿足下列需求的:

“協議”是 URL 的起始部分,直到包含到第一個冒號。 
“主機”描述了主機和域名,或者一個網絡主機的 IP 地址。
“端口”描述了服務器用于通訊的通訊端口。 
路徑名稱描述了 URL 的路徑方面的信息。
“哈希標識”描述了 URL 中的錨名稱,包括哈希掩碼(#)。此屬性只應用于 HTTP 的 URL。 
“搜索條件”描述了該 URL 中的任何查詢信息,包括問號。此屬性只應用于 HTTP 的 URL。“搜索條件”字符串包含變量和值的配對;每對之間由一個“&”連接。 

屬性概覽
hash: Specifies an anchor name in the URL. 
host: Specifies the host and domain name, or IP address, of a NETwork host.  
hostname: Specifies the host:port portion of the URL.  
href: Specifies the entire URL.  
pathname: Specifies the URL-path portion of the URL.  
port: Specifies the communications port that the server uses.  
protocol: Specifies the beginning of the URL, including the colon.  
search: Specifies a query. 

方法概覽
reload Forces a reload of the window's current document.  
replace Loads the specified URL over the current history entry.  


主要功能示例,其他類同:
hash:

newWindow.location.href = http://skylaugh.cnblogs.com
newWindow.location.hash = #59831 


host
A string specifying the server name, subdomain, and domain name.
newWindow.location.href =   http://skylaugh.cnblogs.com
newWindow.location.host = skylaugh.cnblogs.com


href
A string specifying the entire URL.

window.location.href="http://home.NETscape.com/"


pathname
A string specifying the URL-path portion of the URL.

search
A string beginning with a question mark that specifies any query information in the URL.

newWindow.location.href = http://skylaugh.cnblogs.com
newWindow.location.search = ?newsid=111 

二、location之頁面跳轉js如下:
//簡單跳轉
function gotoPage(url)
{
// eg. var url = "newsview.html?catalogid="+catalogID+"&pageid="+pageid;
window.location = url;
}
// 對location用法的升級,為單個頁面傳遞參數
function goto_catalog(iCat)
{
if(iCat<=0)
{
top.location = "../index.ASPx"; // top出去
}
else
{
window.location = "../newsCat.ASPx?catid="+iCat;
}
}
// 對指定框架進行跳轉頁面,二種方法皆可用
function goto_iframe(url)
{
parent.mainFrame.location = "../index.ASPx"; //
// parent.document.getElementById("mainFrame").src = "../index.ASPx";// use dom to change page // 同時我增加了dom的寫法
}
// 對指定框架進行跳轉頁面,因為 parent.iframename.location="../index.ASPx"; 方法不能實行,主要是 "parent.iframename" 中的iframename在js中被默認為節點,而不能把傳遞過來的參數轉換過來,所以用dom實現了該傳遞二個參數的框架跳轉頁面,希望那位仁兄不吝賜教!
function goto_iframe(iframename,url) 
{
parent.document.getElementById(iframename).src = "../index.ASPx";// use dom to change page by iframeName

//}
// 回到首頁
function gohome()
{
top.location = "/index.ASPx";
}
</script>

JavaScript技術javascript中的location用法簡單介紹,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 久久人妻熟女中文字幕AV蜜芽 | 大相蕉伊人狼人久草av | 暖暖视频中国在线观看免费韩国 | 伊人色啪啪天天综合婷婷 | 精品网站一区二区三区网站 | 亚洲精品在线不卡 | 亚洲麻豆精品成人A在线观看 | 麻豆国产精品久久人妻 | a在线免费观看视频 | 欧美一区二区在线观看 | 69丰满少妇AV无码区 | 妻中蜜在线播放 | 国产精品久久久久久久久爆乳 | 99re久久热在线播放快 | 国产亚洲精品A久久777777 | 麻豆成人久久精品二区三区网站 | 97人妻碰视频在线观看 | 视频网站入口在线看 | 视频在线免费观看 | 99爱视频在线观看 | 国产免费播放一区二区三区 | 国产精品免费一区二区三区视频 | 被男按摩师添的好爽在线直播 | 搡女人免费免费视频观看 | 妈妈的职业3完整版在线播放 | 欧美熟妇互舔20p | 国产精品爆乳尤物99精品 | 亚洲国产中文在线视频免费 | 天天狠狠色噜噜 | 色偷偷男人 | 国产成人教育视频在线观看 | 怡春院院日本一区二区久久 | 国产人妻XXXX精品HD电影 | 真实国产熟睡乱子伦对白无套 | 中文字幕在线免费观看视频 | 日本久久中文字幕 | 偷窥自拍性综合图区 | 琪琪热热色原日韩在线 | 97无码人妻精品1国产精东影业 | 大学生第一次破女在线观看 | 狠狠色丁香婷婷久久综合五月 |