我想,當用戶點擊一個鏈接從一個頁面值傳遞給其他頁。如何從一個網頁到其他頁面由JavaScript傳遞值和使用PHP中的其他頁面獲取與傳遞的值?
例如
<a href="javascript:void(0)" onclick="window.parent.loadFrame('bloodbankFacilities/specialtyDataTable.php',this.innerHTML);">Blood Bank Facilities </a>
上面是鏈接我必須將用戶重定向到specialityDataTable.php
我想,當用戶點擊鏈接來傳遞的文本值來specialityDataTable.php和通過使用php GET方法獲取specialityDataTable.php中的值並對其進行回顯。
我以前好做,但我忘了怎麼辦呢:(。
function loadFrame(url,anchorText){
//alert(url);
if(document.getElementById(url)){
if(hasClassName(document.getElementById(url),"selectedTabHead")){
return false;
}
else{
changeTab(url,document.getElementById(url));
return false;
}
}
iframeId = "ifr_"+url;
var iframeElem = getElementsByClass("bodyFrame");
for(var i=0;i<iframeElem.length;i++){
iframeElem[i].style.display = 'none';
}
if(!document.getElementById(iframeId)){
var elt = document.createElement("iframe");
elt.setAttribute("class","bodyFrame");
elt.setAttribute("id",iframeId);
elt.setAttribute("onload","iframeReload();");
document.getElementById('content').appendChild(elt);
}
document.getElementById("loadr").style.display = 'block';
document.getElementById(iframeId).style.display = 'block'
document.getElementById(iframeId).src = url;
var elements = getElementsByClass("tabHead",document.getElementById("tabStrip"));
for(var i=0;i<elements.length;i++){
if(hasClassName(elements[i],"selectedTabHead")){
removeClassName(elements[i],"selectedTabHead");
}
}
var elt = document.createElement("span");
elt.setAttribute("class","tabHead selectedTabHead");
elt.setAttribute("id",url);
elt.innerHTML = "<a href='javascript:void(0);' onclick=changeTab('"+url+"',this.parentNode)>"+anchorText+"</a> <b onclick='removeTab(this.parentNode.id)'>x</b>";
if(elements.length == 0){
document.getElementById("tabStrip").appendChild(elt);
}
else{
document.getElementById("tabStrip").insertBefore(elt,elements[0]);
}
var tabCookie = document.getElementById("tabStrip").innerHTML;
setCookie("<?php echo $_SESSION['userId'] ?>",tabCookie);
setWidth();
//autoHeight();
};
function loadFullScreen(url){
url = "<?php echo ROOT_PATH; ?>"+"full.php?q="+url;
jsPopUp(url,800,1000);
}
function changeTab(url,obj){
// document.getElementById("loadr").style.display = 'block';
parentnode = document.getElementById("tabStrip");
var elements = getElementsByClass("tabHead",parentnode);
for(var i=0;i<elements.length;i++){
if(hasClassName(elements[i],"selectedTabHead")){
removeClassName(elements[i],"selectedTabHead");
}
}
addClassName(obj,"selectedTabHead");
// document.getElementById("bodyFrame").src = url;
iframeId = "ifr_"+url;
var iframeElem = getElementsByClass("bodyFrame");
for(var i=0;i<iframeElem.length;i++){
iframeElem[i].style.display = 'none';
}
//alert(document.getElementById(iframeId));
if(!document.getElementById(iframeId)){
var elt = document.createElement("iframe");
elt.setAttribute("class","bodyFrame");
elt.setAttribute("id",iframeId);
elt.setAttribute("onload","iframeReload();");
document.getElementById('content').appendChild(elt);
}
document.getElementById(iframeId).style.display = 'block'
};
你能提供的函數的定義(代碼) '無線ndow.parent.loadFrame()'? – hakre
加載框架功能現在被添加爲你問。 –