Nimm ein semantisch sinnvolles Element und verwende es.
<!doctype html>
<html>
<head>
<title>Semantisch korrektes Element für JavaScript-Buttons (HTML 5)</title>
<style>
[code lang=css]command {
color: blue;
cursor: pointer;
text-decoration: underline;
}
command:hover {
color: #00a;
}
</style>
<script>
window.onload = initSelectButton;
function initSelectButton () {
var pEl = document.createElement("p"),
commandEl = document.createElement("command");
commandEl.tabIndex = 0;
commandEl.onclick = selectTextareaText;
commandEl.innerHTML = "Text markieren";
pEl.appendChild(commandEl);
document.forms[0].appendChild(commandEl);
}
function selectTextareaText () {
document.getElementById("textarea").select();
}
</script>
</head>
<body>
<form>
<p><textarea id="textarea">Moo</textarea></p>
</form>
</body>
</html>[/code]
http://molily.de/temp/command.html
Mathias