Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JavaScript for the hard-of-thinking

Status
Not open for further replies.
Dec 8, 2003
17,047
GB
I've been reveiwing some code given to us by AdTech, our banner ad provider, and was amazed to see the following code. It really beggars belief that some people write code like this and expect it to work.

I thought I'd post it here just so that if anyone else has trouble getting AdTech code to work when JS is disabled, this might help them out (and provide a laugh into the bargain). Well done, AdTech!

Code:
document.write("<SCR"+"IPT language='JavaScript1.1' SRC=\"[URL unfurl="true"]http://ad.uk.doubleclick.net/ad/[/URL][snip]\">\n");
document.write("</SCR"+"IPT>\n");
[!]document.write("<NOSCRIPT>\n");[/!]
document.write("<A HREF=\"[URL unfurl="true"]http://adserver.adtech.de/adlink[/URL][snip]\">\n");
document.write("<IMG SRC=\"[URL unfurl="true"]http://ad.uk.doubleclick.net/ad/[/URL][snip]\" BORDER=0 WIDTH=300 HEIGHT=250 ALT=\"Click Here!\"></A>\n");
[!]document.write("</NOSCRIPT>\n");[/!]

var adcount_1584317_=new Image();
adcount_1584317_.src="[URL unfurl="true"]http://adserver.adtech.de/adcount[/URL][snip]";



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
This means I'm too dumb but, where's the funny part?

The NOSCRIPT starts working when you include it and the next document.write() doesn't work?

Cheers,
Dian
 
The fact they are using 'document.write' means scripting is enabled if this code is running. So why bother writing out a 'noscript' section at all?



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
That is great! I needed a good laugh today.
 
Hi

I just found a nice one in Yahoo! Mail :
Code:
<noscript>
	<META HTTP-EQUIV=Refresh CONTENT="0; URL=/ym/login?nojs=1">
<style>* { visibility: hidden; }</style>
<script>
document.write('<style>* { visibility: visible; }</style>');
</script>
</noscript>

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top