View Single Post
Old 04-13-2012, 10:03 AM   PM User | #3
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,465
Thanks: 0
Thanked 499 Times in 491 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Quote:
Originally Posted by lerura View Post
You use <script><noscript> the right way.

But there is no reason for style the spans with text-decoration.
The only content it has is a link that by default is underline.

In fact you do not need the spans at all here.

Code:
<p class="download">
<script>
document.write('<a href="javascript:void(0);" onclick="window.open('http://www.webchild.com.au/mediakit/Direct_Media_Kit_Web.pdf?nocache='+Math.floor( Math.random()*11 ) );">The Child Magazines Media Kit</a> (PDF 1 MB) ");
</script>
<noscript>
<a href="http://www.webchild.com.au/mediakit/Direct_Media_Kit_Web.pdf">The Child Magazines Media Kit</a> (PDF 1 MB)
</noscript>
</p>
will suffice
That's the 1996 way of doing it. You don't need to use either of the antiquated commands document.write or <noscript> to do this.

The following is all that you need to do it:

Code:
<a
 href="http://www.webchild.com.au/mediakit/Direct_Media_Kit_Web.pdf"
 onclick="window.open(\'http://www.webchild.com.au/mediakit/Direct_Media_Kit_Web.pdf?nocache=\'+Math.floor( Math.random()*11 ) );return false;">The Child Magazines Media Kit</a>
Note that the onclick simply needs to return false to prevent the href being followed.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote