title: Call javascript of another page in ajax xmlHttp.open
body: <p>I have a jsp  page DEMO1.jsp in which i have written ajax code to refresh every 1 minutes.In DEMO1.JSP I HAVE </p>
  
  <pre><code>&lt;head&gt;
  
      &lt;script type='text/javascript'&gt;
          setInterval(function(){
              document.getElementById('bgframe').contentWindow.myInternalFunction();
          }, 5*1000);
  
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload="AutoRefreshValid();"  style="margin:1px;font-family: Serif, Arial,Times, serif;" id="ValidWaybills"&gt;&lt;center&gt;
  
      &lt;iframe id='bgframe' style='display:none;' src='DEMO2.jsp'&gt;&lt;/iframe&gt;
  
      &lt;script type="text/javascript"&gt;
          function AutoRefreshValid(){
              var xmlHttp;
              try{
                  xmlHttp=new XMLHttpRequest();// Firefox, Opera 8.0+, Safari
              }
              catch (e){
                  try{
                      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer
                  }
                  catch (e){
                      try{
                          xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
                      }
                      catch (e){
                          alert("No AJAX");
                          return false;
                      }
                  }
              }
  
              xmlHttp.onreadystatechange=function(){
                  if(xmlHttp.readyState==4){
                      document.getElementById('ValidWaybills1Valid').innerHTML=xmlHttp.responseText;
                      setTimeout('AutoRefreshValid()',5*1000);
                  }
              }
  
              xmlHttp.open("GET","DEMO2.jsp",true);
              xmlHttp.send(null);
  
  
  
          }
      &lt;/script&gt;
      &lt;div  id="ValidWaybills1Valid"&gt;
  
      &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>I HAVE DEMO2.JSP WHERE I HAVE WRITTEN JAVASCRIPT 
  I HAVE TO RUN THAT JAVASCRIPT USING AJAX IN DEMO1.JSP WITHOUT RELOADING THE PAGE EVERY 5 SECONDS</p>
  
  <pre><code>&lt;head&gt;
  
  
      &lt;script type="text/javascript"&gt;
          function callme3(){
  
          &lt;%  Date d1 = new Date();
          %&gt;
                  alert("Date is          &lt;%=d1%&gt;");
              }
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload="callme3()"&gt;
  
  
  
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>Thanks and regads 
  Sudarshan </p>