Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can i underline access key on a button?

Status
Not open for further replies.

Samoyed

Programmer
Jul 13, 2001
17
CA
Hi,

Currently I have a button that has a shortcut key of o. I'd like to display this as Policies, with the letter o underlined.

This is the current code. How does one go about doing this?

<input type="button" accesskey=o value=Policies tabindex=210 accesskey=O onclick=Policies title="Add/Edit Policies"></button>

Thx in advance
 
Don't know if the BUTTON tag is being phased out, but you could do this:

Code:
<button accesskey=o>P<u>o</u>licies</button>

...adding in the title, onclick property, etc.

'hope that helps.

--Dave
 
By the way, in the code YOU posted, you wouldn't have a </button> tag. Rather, to follow XHTML guidelines, you would type:

Code:
<input type="button" accesskey=o value=Policies tabindex=210 accesskey=O onclick=Policies title="Add/Edit Policies"[b] /[/b]>

In 'singleton' tags (shch as INPUT or BR), add a space, then a forward-slash before the closing angle-bracket (as in the above).

--Dave
 
Yes, you can! You can use the <button> element instead of <input> (I noticed you had a </button>).

Here is the code:

<button accesskey=o tabindex=210 accesskey=O onclick=Policies title="Add/Edit Policies">P<u>o</u>licies</button>

See the <u>o</u>? It underlines the 'o' in Policies.
 
Hi Everyone,

THANK YOU for your help. Now my button can change colors and display the underline. Heres what I did.

<script language=vbscript>
sub change(color)
if (window.event.srcElement.tagName="INPUT") OR (window.event.srcElement.tagName="BUTTON") then
window.event.srcElement.style.backgroundColor=color
end if
End sub
</script>

<style>
.color2{font-weight:bold;background-color:63639c}
</style>

<button tabindex=210 accesskey=o onmouseover=change('yellow') onMouseout=change('CFCFCF') onclick=Policies title="Add/Edit Policies">P<u>o</u>licies</button>
 
The <button> tag isn't getting slashed yet. It IS valid in XHTML 1.1, the most recent and USABLE version of HTML. I say usable because XHTML 2.0 is the most recent. However, it is not usable by the public yet since it is still being developed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top