/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Javascript works in FF not IE, what gives?

Hey all,

I have tried to update some code using javascript to perform a onclick event, this works great in FireFox, but gives me an error in IE6 and IE7.

The error:

form.ccd_num is null or not an object

here is my code:

[CODE]
<form name=”setISSUE” method=”post” action=””>

<td nowrap>Issue Type</td>
<!– Value 14 is CCD –>
<td><select name=isstype id=isstype onChange=”javascript: if(this.value == ’14’) {form.ccd_num.disabled=false;form.ccd_num.value=”} else {form.ccd_num.disabled=true;form.ccd_num.value=’0′}”>
<option value=0>SELECT</option>
<?php
print $optiss;
?>
</select></td>

</form>
</tr>

<tr>
<td nowrap align=left> Subject</td>
<td nowrap align=left colspan=5> <input type=text size=81 name=subj> CCD# <input type=text name=ccd_num disabled value=’0′> </td>
</tr>

[/CODE]

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@Arty_EffemNov 13.2006 — [code]<input type=text name=ccd_num disabled value='0'>[/CODE][/QUOTE]Try putting that element [I]inside[/I] the form. Its would be more precisely referenced as: this.form.ccd_num
Copy linkTweet thisAlerts:
@Phill_PaffordauthorNov 13.2006 — sry I am a newb when it comes to javascript.

I am using inline javascript, how would I add the element to the form?
Copy linkTweet thisAlerts:
@why2kNov 14.2006 — I'm having a similar error one three of my sites! Its driving me nutts!!
Copy linkTweet thisAlerts:
@Phill_PaffordauthorNov 14.2006 — Try putting that element [I]inside[/I] the form. Its would be more precisely referenced as: this.form.ccd_num[/QUOTE]

Still having trouble implementing this
Copy linkTweet thisAlerts:
@Phill_PaffordauthorNov 14.2006 — ok so I have come up with this, but its still not right, but all most there

[CODE]
function check_ccd()
{
ccd_val = document.getElementById("isstype");
ccd_sel = ccd_val.value;

if(ccd_sel == '14')
{
document.getElementById('ccd_num').value = '';
document.getElementById('ccd_num').disabled=false;
}
else
{
document.getElementById('ccd_num').value = '0';
document.getElementById('ccd_num').disabled=true;
}
}

[/CODE]
Copy linkTweet thisAlerts:
@Phill_PaffordauthorNov 14.2006 — I figured it out.

used with the code in above post
[CODE]
<td nowrap>Issue Type</td>
<td><select name=isstype id=isstype onChange="check_ccd()">
<option value=0>SELECT</option>
<?php
print $optiss;
?>
</select></td>

</tr>

<tr>
<td nowrap align=left> Subject</td>
<td nowrap align=left colspan=5> <input type=text size=81 name=subj> CCD# <input type=text id= ccd_num name=ccd_num value='0' disabled > </td>
</tr>

[/CODE]
×

Success!

Help @Phill_Pafford 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 5.15,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...