On 12/11/06, Andy Pemberton <[EMAIL PROTECTED]> wrote:
> Russ:
>
> Though this is more of a javascript/html dom question, I'll answer anyway.
>
> You must return false in the 'onclick' method of the link you're using to
> fire this javascript event. This will prevent the browser from following the
> href attribute.
>
> So your markup should look like:
>
> <a href="#" onclick="ShowHideLayer('TISdata'); return false; ">Truth
> In Savings Disclosure</a>
>
> I'd also argue, however, that you should include the URL of a page that has
> this dynamic content in place.  This will enable browsers without javascript
> or that have javascript disabled to view the content.

Good point.  You can safely combine them...

<a href="url-for-non-javascript-browsers"
onclick="functionForJavascriptBrowsers(); return false">Click here</a>

In some cases, the page is a total loss to non-javascript browsing,
which is best handled by directing those users to another page
entirely in the first place.  If that's the case, you can assume
javascript for the page in question and simplify the above to this:

<a href="javascript:functionForJavascriptBrowsers()">Click here</a>

No onclick handler or false return value needed - the javascript: uri
method causes the function to be invoked when the link is clicked,
with no other action taken.


>
>
> Hope this helps,
> Andy
> ______________________________________________________________________
> css-discuss [EMAIL PROTECTED]
> http://www.css-discuss.org/mailman/listinfo/css-d
> IE7 information -- http://css-discuss.incutio.com/?page=IE7
> List wiki/FAQ -- http://css-discuss.incutio.com/
> Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
>


-- 
Mark J. Reed <[EMAIL PROTECTED]>
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7 information -- http://css-discuss.incutio.com/?page=IE7
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to