Dynadot โ€” .com Transfer

JAVASCRIPT - Doesn't Work in FireFox

SpaceshipSpaceship
Watch

boomers

Established Member
Impact
4
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?

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...
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
No problems on my firefox. It works! Do you have the latest version installed on your computer or check your Tools -> Options -> Content to enable JavaScript.
 
0
•••
Alternatively, open your Javascript Console from the Tools menu. The errors that are listed there should tell you the problem.
 
0
•••
CatchedCatched
Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomainEasy โ€” Live Options
DomDB
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back