ok, i’m new to javascript and was just messing around writing some functions and stuff, and wrote this…
[code=php]
function myStuff()
{
var val1 = stats.text1.value
var val2 = stats.text2.value
if (val1==val2 && val1!=0 && val2!=0)
{
alert(“Matches”)
}
else
{
alert(“Does not match or value is 0”)
}
}
as you can see this verifys that the value of two text fields match… but if i wanted to write the result to a text field instead of making an alert… wouldnt i replace an alert with this:
document.getElementById(“ans”).value = “Matches”;
this doenst work though… it doesnt write to the text field and i cant figure out why it wouldnt work, ive used getElementById() before and its worked fine. well, its nothing important but im just trying to learn js and i cant figure out the problem, thanks…