English 中文(简体)
如何调整外部产生的动态联系
原标题:How to redirect an externally generated dynamic link

Some time ago I thought about how to reduce the costs of my webpage. I decided to use an advertisement. It is a text-link-ad. When the text-link is clicked the advertisement is opened in a new tab.

在经过一段时间之后,我真心 that地认识到,不仅对我来说,而且对访问我的网页的所有人来说,这真是徒劳的。

我提出的解决办法是制定一个框架。 我知道框架 s,但这是我可以认为的唯一解决办法。

它看着这样的情况:

<frameset rows="0.01%,99.99%" border="0" SCROLLING=NO NORESIZE>
<frame src="script" name="script">  
<frame src="advertisement.html" name="advertisement ">
</frameset>

在文字镜头一号中,用java字母将参观者转回我的网页,然后把 mo点点击到(登机知道什么是:)窗户。

So now to my problem:
I ve got this generated link from sponsorad.de

<script type="text/javascript" src="http://www.sponsorads.de/script.php?s=209836"></script>

正在执行的文字是:

<script type="text/javascript">
    var preferrer=  ;`
try {
        preferrer = top.document.referrer;
    } catch (e) {
        preferrer =   ;
    } finally {
        var rndVal = 100*(Math.random());
        document.write( <!--  +rndVal+ --> );
        document.write( <scr  +  ipt type="text/javascript"
           src="http://www.sponsorads.de/a_script.php?s=209836&pref=  +
           escape(preferrer) +
            &ref=  + 
           escape(document.referrer) + 
            &ck=1&rndVal=  +
           rndVal +
            "></scr  + 
            ipt> 
         );
     }
</script>

So how can i make this link open in my advertisement-frame?
I m open for a Javascript, jQuery, .htaccess or any other solution.

问题回答
<script type="text/javascript">
  var preferrer=  ;`
  try {
    preferrer = top.document.referrer;
  } catch (e) {
    preferrer =   ;
  } finally {
    var rndVal = 100*(Math.random());
    var txt =  <!--  +rndVal+ --> ;
    txt +=  <script type="text/javascript"
       src="http://www.sponsorads.de/a_script.php?s=209836&pref=  +
       escape(preferrer) +
        &ref=  + 
       escape(document.referrer) + 
        &ck=1&rndVal=  +
       rndVal +
        "></script> ;
    window.advertisement.document.write(txt);
    window.advertisement.document.close();
  }
</script>

或者,如果你不想打脚本,就这样做:

<script>
var oldWrite = document.write;
document.write=function(str) {
  window.advertisement.document.write(str);
}
</script>
<script type="text/javascript" src="http://www.sponsorads.de/script.php?s=209836"></script>
<script>
document.write=oldWrite;
window.advertisement.document.close();
</script>




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

热门标签