Posted by Jim Higson on 06/18/06 19:43
David Dorward wrote:
> Jim Higson wrote:
>
>> <a href="javascript:whatever()" style="display:none"
>> id="js-link">blah</a>
>
>> This way, the link will only be shown if the user has javascript enabled.
>
> Or stylesheets disabled or unavailable.
Like I said in the grandparent post, a better way still is to create the
link altogether in js using DOM. Something like:
<span id="link-placeholder" />
<script type="text/javascript">
var a_ele = document.createElement ( 'a );
a_ele.setAttribute( 'href', 'javascript:whatever()' );
a_ele.appendChild( document.createTextNode( 'blah' ));
var placeholder_ele = document.getElementById( "screensaver-intro" );
placeholder_ele.parentNode.replaceChild( a_ele, placeholder_ele );
</script>
Now, I think that covers all bases?
--
Jim
[Back to original message]
|