eeer... Nischumacher, document's elements must have the
document object as root refrence. IE incorrecty accepts that shorthand, but objects, on a page, might belong to the window (variables, functions) or might belong to the document (tags, textNodes...). A form's element must also be referenced so.
On the other hand, if passing a string value to a function, pass it as a
string, not as an
object. The object and the object's name/id are
different things.
Your code should have looked like
<input type="button" name=
"btnReplace
" value="Replace" onclick="
document.getElementsByName('TeXTio')[0].value=document.getElementsByName('TeXTio')[0].value.replace(/'/g, '`');">
Or use id instead of name, and getElementById(id)
But, in this particular case, it is enought to use
this self reference and onkeyup event.
And, the last but not the least, I guess that the safest way to deal with special characters in javascript is to use unicode escapes (according to the charset specification). So that things are much more simplier so:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Script-Type" content="text/javascript">
</head>
<body>
<input type="text" onkeyup="this.value=this.value.replace(/\u0027/,'\u0060')">
</body>
</html>