We're calling on all EU-based Mozillians with iOS or iPadOS devices to help us monitor Apple’s new browser choice screens. Join the effort to hold Big Tech to account!

Funkcionalnosć toś togo sedła se pśez wótwardowańske źěła wobgranicujo, kótarež maju wašo dožywjenje pólěpšyś. Jolic nastawk waš problem njerozwězujo a cośo pšašanje stajiś, wobrośćo se na našo zgromoźeństwo pomocy, kótarež na to caka, wam na @FirefoxSupport na Twitter a /r/firefox na Reddit pomagaś.

Pomoc pśepytaś

Glědajśo se wobšudy pomocy. Njenapominajomy was nigda, telefonowy numer zawołaś, SMS pósłaś abo wósobinske informacije pśeraźiś. Pšosym dajśo suspektnu aktiwitu z pomocu nastajenja „Znjewužywanje k wěsći daś“ k wěsći.

Dalšne informacije

// Problem with JavaScript coding //

  • 3 wótegrona
  • 1 ma toś ten problem
  • 2 naglěda
  • Slědne wótegrono wót RickTrelles

more options

I'm new to JavaScript and even to website coding. I'm trying to populate a form dynamically and am having trouble with FF7.

To start I couldn't even pass the name of the form as an argument with FF7. After simplifying the code to see what's basically wrong I have come to something funny.

In the code below at least the input element gets initiated, but if I just declare a variable then it doesn't!

With IE8 and even IE6 all my original code worked perfect. I could populate the whole form and then change it dynamically.

What am I doing that FF doesn't get?

Thank you.

Rick Trelles


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>

<script type="text/JavaScript">
function fillInput()
{
alert("entered to populate");

// just by uncommenting this single line there is problem
//var myform = dateform1;

document.getElementById('tofill').value = 999;

// of course this never works
//myform.elements["tofill"].value = 999;
}
</script>
</head>

<body onload="fillInput()">

<FORM NAME="dateform1">
<b>Input:</b>
<input id="tofill" size=4 maxlength=4  ></input>
</FORM>

</body>
</html>
I'm new to JavaScript and even to website coding. I'm trying to populate a form dynamically and am having trouble with FF7. To start I couldn't even pass the name of the form as an argument with FF7. After simplifying the code to see what's basically wrong I have come to something funny. In the code below at least the input element gets initiated, but if I just declare a variable then it doesn't! With IE8 and even IE6 all my original code worked perfect. I could populate the whole form and then change it dynamically. What am I doing that FF doesn't get? Thank you. Rick Trelles <pre><nowiki> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <script type="text/JavaScript"> function fillInput() { alert("entered to populate"); // just by uncommenting this single line there is problem //var myform = dateform1; document.getElementById('tofill').value = 999; // of course this never works //myform.elements["tofill"].value = 999; } </script> </head> <body onload="fillInput()"> <FORM NAME="dateform1"> <b>Input:</b> <input id="tofill" size=4 maxlength=4 ></input> </FORM> </body> </html></nowiki></pre>

Wót cor-el změnjony

Wubrane rozwězanje

Try posting at the Web Development / Standards Evangelism forum at MozillaZine. The helpers over there are more knowledgeable about web page development issues with Firefox.
http://forums.mozillazine.org/viewforum.php?f=25
You'll need to register and login to be able to post in that forum.

Toś to wótegrono w konteksće cytaś 👍 0

Wšykne wótegrona (3)

more options

Oh no, the message was clipped without warning!

Which is a good place to get help with javascript for Firefox?

more options

Wubrane rozwězanje

Try posting at the Web Development / Standards Evangelism forum at MozillaZine. The helpers over there are more knowledgeable about web page development issues with Firefox.
http://forums.mozillazine.org/viewforum.php?f=25
You'll need to register and login to be able to post in that forum.

more options

Thank you.