[thelist] Looking for Mr. JavaScript

Stephen Caudill SCaudill at municode.com
Thu Feb 12 09:28:51 CST 2004


--------------- Sam Carter wrote: --------------- 
 
: I need a JavaScript that will emulate the function of the
: browser's back button on
: 
: <img src="backbutton.gif" onclick="myscript">
: 
: with this caveat:
: 
: If JavaScript is disabled, I need to *NOT* render the <img>,
: instead - render text that reads "Use your browser's back button
: to return". 
: 
: <noscript> should take care of the latter, but I'm not sure how I
: can omit rendering of the <img onclick="myscript"> if JS is
: disabled?  After all, JS will be disabled, so it isn't a tool
: that can omit rendering. 
: 
: Any ideas? CSS display:none when JavaScript is disabled?  Any way
: to do that?
: 
: Sam

Just write out the image tag with javascript... no javascript, no 
image:

<script type="text/javascript">
document.writeln('<img src="mypic.gif" onclick="history.back(1)" style="cursor:hand;" />');
</script>
<noscript>
<p>"Use your browser's back button to return"</p>
</noscript>

hth,
Stephen
http://www.mechavox.com/


More information about the thelist mailing list