Click to See Complete Forum and Search --> : To <p> or not to <p>


ldoodle
04-02-2009, 09:51 AM
I have this code:

<div class="module">

<p>

<span class="float_right">

<a href="" onclick="toggle('<%= strCategoryName %>'); return false;">

<img id="<%= strCategoryName %>Image" src="/images/collapse_module.png" alt="Collapse " title="Collapse this module " />

</a>

</span>

<img src="/images/web_links.png" alt="Web Link " /><%= strCategoryName %>

</p>

</div>

Is the use of <p> correct in this instance?

Thanks

Fang
04-02-2009, 10:48 AM
<div>
<img /><img />
</div>

Declan1991
04-02-2009, 02:41 PM
Neither the span nor the p is needed, and even the <a> can be removed by putting the onclick on the img tag instead of the <a>.

WebJoel
04-02-2009, 09:17 PM
What Fang said. :)
Wondering, -if the "<a>" is removed and an 'onClick' on the "<img>" is used instead, -does this deprive user-agents for the handicapped from realizing this is a 'link' because the element would not identify itself as being an "anchor" tag? Just wondering.
The hyperlink would work, but for a blind person, the 'reader' might not identify the element with 'onClick' as being 'clickable.' Anyone? (I seriously need to re-install JAWS and check some of these issues out..) :o

dmboyd
04-02-2009, 10:06 PM
As mentioned, only the "<img/>" tags are needed.

In addition, user agents that don't support scripting should not have an issue with the onclick, though I can't remember whether the page would simply reload the page or not when a link with href="" is used; such behaviour would definitely make a user's browsing experience painful.

As for JAWS, I can't really test, but I would assume that it wouldn't recognise it as being clickable. After all, just because there is an onclick attribute, that doesn't mean it is a link, and that's all a screen reader should really be searching for IMHO.

Fang
04-03-2009, 07:49 AM
Wondering, -if the "<a>" is removed and an 'onClick' on the "<img>" is used instead, -does this deprive user-agents for the handicapped from realizing this is a 'link' because the element would not identify itself as being an "anchor" tag? Just wondering.
The hyperlink would work, but for a blind person, the 'reader' might not identify the element with 'onClick' as being 'clickable.' Anyone? (I seriously need to re-install JAWS and check some of these issues out..) :oEasy enough to change the cursor for the mouseover. Jaws will recognize the event.
The only problem is that JavaScript is required for the document to be functional.

ldoodle
04-04-2009, 04:20 PM
Thanks.

The reason the span is there is as a container for the possibility of multiple items.

Fang
04-05-2009, 01:07 AM
If the full markup is not given, how can we comment on the use of <p>?

felgall
04-05-2009, 05:01 PM
If the whole thing is a part of a paragraph then why wrap the paragraph in a div rather than just applying the div styles directly to the paragraph. If it isn't a paragraph then the <p> tags shouldn't be there. Wrapping a paragraph in a div shouldn't be required (except in the rare instance where the required appearance can't be achieved by styling the paragraph and styling at two levels is required).