hwo to implement Double Click

Use JavaScript code to prevent browser caching
If a random number cannot be generated at the server level, you can use JavaScript code to generate a string at the client (browser) level. The following examples illustrate how to prevent browser caching (also known as implementing cache busting) with a standard image tag or Iframe/JavaScript tag.

These are only examples. If you want to use this code, please adapt it for your specific HTML tags. You must paste the actual tags into the appropriate places in these examples.
Example of standard image tags
<SCRIPT LANGUAGE="JavaScript">
<!== hide from non-JavaScript browsers
var axel = Math.random() + "";
var num = axel * 1000000000000000000;
document.writeln('<A HREF="http://ad.doubleclick.net/jump/N409.somesite/B470;sz=468x60;ord='+ num +'?"><IMG SRC="http://ad.doubleclick.net/ad/N409.somesite/B470;sz=468x60;ord='+ num +'?" BORDER=0 WIDTH=468 HEIGHT=60 ALT="Click Here!"> Click Here!</A>');
// end hide from browsers ==>
</SCRIPT>
<NOSCRIPT>
<A HREF="http://ad.doubleclick.net/jump/N409.somesite/B470;sz=468x60;ord=[timestamp]?">
<IMG SRC="http://ad.doubleclick.net/ad/N409.somesite/B470;sz=468x60;ord=[timestamp]?" BORDER=0 WIDTH=468 HEIGHT=60 ALT="Click Here!"> Click Here!</A>
</NOSCRIPT>


Example of Iframe/JavaScript tags
<SCRIPT LANGUAGE="JavaScript">
<!== hide from non-JavaScript browsers
var axel = Math.random() + "";
var num = axel * 1000000000000000000;
document.writeln('<IFRAME SRC="http://ad.doubleclick.net/adi/N409.somesite/B470;sz=468x60;ord='+ num +'?" WIDTH=470 HEIGHT=62 MARGINWIDTH=0 MARGINHEIGHT=0HSPACE=0 VSPACE=0 FRAMEBORDER=0 SCROLLING=no BORDERCOLOR="#000000">');
document.writeln('<SCR'+'IPT language="JavaScript1.1" SRC="http://ad.doubleclick.net/adj/N409.somesite/B470;abr=!ie;sz=468x60;ord='+ num +'?"></SCR'+'IPT></IFRAME>');
// end hide from browsers ==>
</script>
<noscript>
<A HREF="http://ad.doubleclick.net/jump/N409.somesite/B470;abr=!ie4;abr=!ie5;sz=468x60;ord=?">
<IMG SRC="http://ad.doubleclick.net/ad/N409.somesite/B470;abr=!ie4;abr=!ie5;sz=468x60;ord=?" BORDER=0 WIDTH=468 HEIGHT=60 ALT="Click Here!">Click Here!</A>
<noscript>

 

http://advertisersapi.doubleclick.net/v1.8/api

 

<script type="text/javascript">generateSpotlightTags("tracking", "http://ad.uk.doubleclick.net/activity;src=123456;type=nov12345;cat=abcdefgh;ord=1;num=" + (Math.random() * 10000000000000));</script>
<noscript>
<div><img src="http://ad.uk.doubleclick.net/activity;src=123456;type=nov12345;cat=abcdefgh;ord=1;num=1?" width="1" height="1" alt="DoubleClick Spotlight tracking image" class="noscript" /></div>
</noscript> 

	
/*code to generate doubleclick spotlight tags using valid XHTML*/ function generateSpotlightTags(container, url) { //is url valid if (url != "" && url != null) { //does browser support DOM scripting? if (document.getElementById) { //find the container var _con = document.getElementById(container); if (_con != null) { //create a new <image> element var _img = document.createElement('img'); _img.setAttribute('alt', 'DoubleClick Spotlight tracking image'); _img.setAttribute('src', url); _img.setAttribute('width', "1"); _img.setAttribute('height', "1"); //attach <img> to container _con.appendChild(_img); } } //does browser support document.images? else if (document.images) { var _img = new Image(); _img.src = url; } //does browser support document.write? else if (document.write) { document.write("<img src=\"" + url + "\" alt=\"\" width=\"1\" height=\"1\" />"); } } } 

你可能感兴趣的:(JavaScript,.net,cache,XHTML,IE)