Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

JAVASCRIPT - Doesn't Work in FireFox

SpaceshipSpaceship
SpaceshipSpaceship
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
Close
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
Close
Alternatively, open your Javascript Console from the Tools menu. The errors that are listed there should tell you the problem.
 
0
Close
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Member card: see how many threads a member started
The member card now shows a Threads number, right after Posts. The member card is the box that opens when you point at a name. Profile...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back