English 中文(简体)
查阅窗户在碎块中的表格中的全球变数
原标题:Accessing the global variable of a window from its tabs in jquery

我有一页jquery 表格。 每一表载数据来自另一页的html。 我正在集装箱的html网页上设定一个全球变量,希望在其表格中查阅。 如何这样做? 我尝试了窗户,窗户。 但没有任何东西可以奏效。 我已附上该守则。 友好帮助。

www.un.org/Depts/DGACM/index_spanish.htm 页: 1

<html>
<head>
<link type="text/css" href="../../css/ui-lightness/jquery-ui-1.8.14.custom.css" rel="Stylesheet" /> 
<link type="text/css" href="./methodeditor.css" rel="stylesheet" />
<script type="text/javascript" src="../../js/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="../../js/jquery-ui-1.8.14.custom.min.js"></script>

<script>
    $(function() {
        $( ".tabs" ).tabs({cache:true});
    });  
</script>
<script>

var method = " ";
function setmethod(m) {
    method = m;
}
function loadtabs(){


          method = window.parent.method;
          setmethod(method);
          $("#oven").load( oven.html );
          $("#detectors").load( detectors.html );
          $("#inlets").load( inlets.html );

    }
</script>
</head>
<body>
<form id="editor" action="method.php" method="POST" >
<div class="editor">

<div class="tabs">

    <ul>
        <li><a href="#oven">Temperature</a></li>
        <li><a href="#detectors">Timing</a></li>
        <li><a href="#inlets">Vial and Loop</a></li>
    </ul>
    <div id="oven" ></div>
    <div id="detectors" ></div>
    <div id="inlets"> </div>

</div>
<script>
loadtabs();
</script>
</form>
</div>
</body>
</html>

<>strong>oven.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<script>
function getvalues() {
          file = window.method;
          //file = m;
          file = "./method/"+file;
          var xmlhttp = new XMLHttpRequest();
          xmlhttp.open("GET", file, false);
          xmlhttp.setRequestHeader( Content-Type ,  text/xml );
          xmlhttp.send("");
          xmldoc = xmlhttp.responseXML;
          etimenode = xmldoc.getElementsByTagName("method")[0].childNodes[1].childNodes[1];
          etime = etimenode.textContent;
          document.getElementById("etime").value =  etime;    
}
</script>
</head>

<body>
<input type="checkbox" name="oventemp" value="ON" />Oven Temperature
Equilibrium time <input type="text" id="etime"  />
<script>
getvalues();
</script>
</body>
</html>
问题回答

你可以包括你在显示该页的负荷时所需要的变量,例如:

setmethod(method);
$("#oven").load( oven.html?var1=  + myvar1 +  &var2=  + myvar2 );

然后,在Oven.html上,您可使用以下方法:,作为将在该装页范围内工作的全球斜体加以涂 gr:





相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签