2014-09-30 55 views
0

我有兩個頁面分別如何在兩個不同頁面之間導航時打開div?

Customer.html 
index.html 

我從一個頁面重定向到另一個頁面,如圖

Customer.html

window.location = "customer/index.html?qruuid="+uuid; 

的index.html

我正在檢索qruuid值並將其重定向回Cus tomer.html

else if(qruuid!='') 
{ 
window.location = "../Customer.html?UUID="+qruuid; 

} 

我在這裏的問題是,當我回來重定向(從index.html的到Customer.html)頁面

是否有可能與特定的div打開顯示Customer.html? ?

這是我Customer.html下名爲「restaurantmenu」一類,我想表明,在打開狀態時,我重定向回

$("#restaurantmenu").show(); 
+0

你可以尋找查詢字符串(或引用),如果它是正確的,觸發'$( 「#restaurantmenu」)。秀( );'在頁面加載。 – sideroxylon 2014-09-30 09:55:55

+0

可以請讓我知道什麼是查詢字符串? – Pawan 2014-09-30 09:57:17

+0

「?」後的URL部分。 – sideroxylon 2014-09-30 09:59:00

回答

1

當你從指數重定向您可以添加一個參數。 HTML到customer.HTML。像

window.location = "../Customer.html?UUID="+qruuid+";isDivOpen=true;"; 

檢索參數isDivOpen,如果它是真的。然後

$("#restaurantmenu").show(); 
+0

我正在使用jquery,所以你的意思是在jquery的ready函數中,我應該這樣做? – Pawan 2014-09-30 09:58:30

+0

是的,你可以在jquery.ready下使用它 – 2014-09-30 09:59:17

1

如果返回的URL是"../Customer.html?UUID="+qruuid

$(document).ready(function() { 
    s = location.search; 
    if(s.indexOf('qruuid') != -1) { 
    $("#restaurantmenu").show(); 
    } 
});