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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript working in IE but not in Firefox

Status
Not open for further replies.

rravenn

Programmer
Jul 6, 2004
40
US
I want to add buttons with characters to the page, creating on-page keyboard for weird-latin letters - ones with cedillas, breves etc.

I have the following code:

<button type="button" onclick="javascript:addCharacter(this);">&#287;</button>

Fucntion is defined in the <head> and is like this:
Code:
function addCharacter(tsource)
{
	//alert(tsource.innerText);
	searchform.q.value += tsource.innerText;
	searchform.q.focus();
}
Everything's ok in IE, but in Firefox, alert returns undefined if I uncomment it, and nothing works. Why's that?
 
try this, works for me

Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<script>
function addCharacter(tsource)
{
    //alert(tsource.innerText);
    searchform.q.value += tsource.value;
    searchform.q.focus();
}
</script>

</head>
<body>

<form action="" method="post" name="searchform" id="searchform">
<input type="text" name="q">
<input type="button" onclick="addCharacter(this);" value="&#287;">
</form>
</body>

</html>
 
Have you tried this:

<input type="button" onclick="addCharacter(this);" value="&#287;" />

and

function addCharacter(tsource)
{
alert(tsource.value);
searchform.q.value += tsource.value;
searchform.q.focus();
}

Lee
 
Yours is the whole page, mine is just code snippets. Anyway, that should confirm what a correct solution is. :)#

Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top