|
Posted by Jonathan N. Little on 06/18/06 20:17
Jim Higson wrote:
> 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.
> JaavScip
> 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?
>
Well to be precise you only use JavaScript in that post to remove the
element's styling that was hiding it...not to create the link.
--
Take care,
Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
[Back to original message]
|