English 中文(简体)
Javascript Fails when opened in an Iframe or as file, but Works when Opened as Part ofrails服务器
原标题:Javascript Fails When Opened In an Iframe or as File, but Works When Opened As Part of Rails Server

我试图将一些 j印放在一旁。 贾瓦特公司在我开放时作为我的铁路服务机,即铁路服务机的一部分运作。 作为公共/公共名录的一部分,我宣布开放。

然而,当我开放时,它就失败了,要么只是一个简单的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><script src="http://www.google.com/adsense/search/ads.js" type="text/javascript"></script><script src="http://www.google.com/uds/api/ads/3.0/7945945e138d6d2d6c753e6353976ff6/search.IN.js" type="text/javascript"></script>
  </head>

  <body>


  <div class = "test" id="afs_adblock_0" style="padding: 0px px; background-color: ; height: 600px; width: 600px;" onmouseover="out_pixel =  /rd/out_pixel?target_host_path=http%3A%2F%2Fadsense.google.com&amp;pvid=7192&amp;msid=5&amp;fpos=0&amp;bpos=0&amp;bid=afs_adblock_0&amp;twiz_val=0&amp;durl=&amp;rq=350&amp;feed_id=0&amp;ex=1326646029&amp;cs=dca4b10de177c97d609359425b227904 ;"></div>


  </body>


<script type="text/javascript" charset="utf-8">
var pageOptions = {
   pubId  :  pub-8639021338656306 ,
   query  :  college ,
   channel  :  5150635874 
};
var afs_adblock_0 = {
   container  :  afs_adblock_0 ,
   minTop  :  1x ,
   fontFamily  :  arial ,
   fontSizeTitle  :  14px ,
   fontSizeDescription  :  12px ,
   fontSizeDomainLink  :  12px ,
   colorTitleLink  :  #0067B1 ,
   colorText  :  blue ,
   colorDomainLink  :  green ,
   colorBackground  :  #D5E9F2 ,
   titleBold  : true,
   verticalSpacing  : 6,
   rightHandAttribution  : true,
   colorAdSeparator  :  white ,
   height  :  500px ,
   width  :  300px ,
   siteLinks  : true,
 adLoadedCallback  : function(containerName, adsLoaded) {if(!adsLoaded){document.getElementById(containerName).style.display =  none ;}; track_afs_results( 7192 , containerName, adsLoaded,  1092dd58f07de305cb14c3a2661fe150 );}};
document.getElementById( afs_adblock_0 ).style.padding= 0px 20px ;document.getElementById( afs_adblock_0 ).style.background= #D5E9F2 ;new google.ads.search.Ads(pageOptions, afs_adblock_0);

    var out_pixel =  /rd/out_pixel 
    var isOverIFrame = false;
    function processMouseOut() {
        isOverIFrame = false;
        top.focus();
    }
    function processMouseOver() { isOverIFrame = true;}
    function processIFrameClick() {
        if(isOverIFrame) {
          var xmlHttp = null;
          xmlHttp = new XMLHttpRequest();
          xmlHttp.open( GET , out_pixel, false);
          xmlHttp.send(null);
        }
    }

    function init() {
        b = document.getElementsByTagName("body")[0];
        if(/MSIE/.test(navigator.userAgent)){
          b.onunload = function() { processIFrameClick() };
        }
        else{
          b.setAttribute( onunload ,  javascript: processIFrameClick() );
        }
        var element = document.getElementsByTagName("iframe");
        for (var i=0; i<element.length; i++) {
            element[i].onmouseover = processMouseOver;
            element[i].onmouseout = processMouseOut;
        }
    }
    setTimeout("init();",800);
    </script>
<script src="http://www.google.com/uds/api/ads/3.0/7945945e138d6d2d6c753e6353976ff6/search.IN.js" type="text/javascript"></script>

What is happening here, I am about to pull out my hair!! What could be the difference between opening a file in an iframe and opening it via the rails server.

最佳回答

该网页使用美国航天中心,因此需要与一个网络服务器通信。 这个网络服务器需要与网页相同。 这不能成为档案。

问题回答
Uncaught TypeError: Cannot call method  match  of undefined
Uncaught track_afs_results is not define

亲爱





相关问题
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.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签