/    Sign up×
Community /Pin to ProfileBookmark

Input from form not seen by functiion

The following code will give the message ‘wireNum.value is null or not an object’ Why?
Thank You for any help.

<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<script language=”javascript”>
<!– Begin
document.bgColor=”#C6EFF7″ // set to light teal
function calculate()
{
var frm=document.getElementsByName(“form”);
document.write(‘<br>’);
document.write(‘COIL FORM CAPACITIES CALCULATOR’);
document.write(‘<br>’);
document.write(‘wireNum content: ‘+frm.wireNum.value);
} // end of function -calculate
// End –>
</script>

<body>
</FONT FACE=”Courier”>
</P><P>
<FORM METHOD=POST>
Wire Size (AWG number 1 thru 44)…..:
<INPUT TYPE = Text NAME = “wireNum” SIZE = 2 value =”18″> <P>
<Input Type = Button NAME = “Calculate” value=”Calculate” onclick=”calculate()” >
</FORM>
</body>
</HTML>

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@FourCourtJesterSep 29.2008 — &lt;html&gt;
&lt;head&gt;
&lt;script type="text/javascript"&gt;
&lt;!-- Begin
document.bgColor="#C6EFF7" // set to light teal
function calculate()
{
var frm=document.getElementById("wireNum");
document.write('&lt;br&gt;');
document.write('COIL FORM CAPACITIES CALCULATOR');
document.write('&lt;br&gt;');
document.write('wireNum content: '+ frm.value);
} // end of function -calculate
// End --&gt;
&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;form method=POST&gt;
Wire Size (AWG number 1 thru 44).....:
&lt;Input type="text" name="wireNum" id="wireNum" size=2 value="18"&gt;&lt;p&gt;
&lt;Input type="button" name="Calculate" value="Calculate" onclick="calculate()"&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
Copy linkTweet thisAlerts:
@phbunyanauthorSep 30.2008 — FourCourtJerster,

Many, many Thanks for the solution to my problem.

Thank You.

Code works great now.
×

Success!

Help @phbunyan spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.1,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...