onClick Event Example

onClick: Open new window example (Accessible)

HTML Example

HTML Source Code

<p><a href="javascript:void(0)" onclick="window.open('http://www.w3.org', '_blank')">World Wide Web Consortium Home in New Window</a></p>

onClick: Parent element problem (Inaccessible)

HTML Example

HTML Source Code

<p onclick="window.open('http://www.w3.org', '_new')"><a href="javascript:void(0)" >World Wide Web Consortium Home in New Window</a></p>

onClick: Tabindex problems (Inaccessible)

HTML Example

HTML Source Code

<p class="tabindex"><a tabindex="0" onclick="window.open('http://www.w3.org', '_blank')">World Wide Web Consortium Home in New Window</a></p>

CSS Source Code


p.tabindex {
  text-decoration: underline;
}