I have some Javascript that takes the input from some textboxes and then puts them all into a sentance automatically. It works perfectly in IE but not with FireFox... does anyone know how to make it work with both browsers?
I needed to put the fields within form tags...
HTML:
<script type="text/javascript">
function Text_Change() {
var TxtFName = document.getElementById("TxtFName");
var TxtSName = document.getElementById("TxtSName");
var TxtAge = document.getElementById("TxtAge");
var TxtLoc = document.getElementById("TxtLoc");
var SpnDisp = document.getElementById("SpnDisp");
var FName = TxtFName.value == "" ? "?" : TxtFName.value;
var SName = TxtSName.value == "" ? "?" : TxtSName.value;
var Age = TxtAge.value == "" ? "?" : TxtAge.value;
var Loc = TxtLoc.value == "" ? "?" : TxtLoc.value;
SpnDisp.innerHTML =
"Hello " + FName + " " + SName + ", " +
"you are " + Age + " years old and " +
"at the moment you live in " + Loc;
}
</script>
<body onload="Text_Change()">
<div><input type="text" id="TxtFName" onchange="Text_Change()" /></div>
<div><input type="text" id="TxtSName" onchange="Text_Change()" /></div>
<div><input type="text" id="TxtAge" onchange="Text_Change()" /></div>
<div><input type="text" id="TxtLoc" onchange="Text_Change()" /></div>
<div><span id="SpnDisp"></span></div>
I needed to put the fields within form tags...






