/    Sign up×
Community /Pin to ProfileBookmark

Onchange problem in Firefox

I have a colleague who is having a problem with the onchnage event in the following script (works fine in IE6). The onkeypress works fine in both browsers.

[CODE]<%if (controller.getLandCostString() != null) { %>
&pound;&nbsp;<input name=”LandCost” type=”text” id=’lc’ size=15 maxlength=25 value=”<%= controller.getLandCostString() %>” onchange=”updateBox();” onkeypress=”return numbersonly(this, event)”/>
<img name=”landcost” src=”images/info.gif” hspace=”3″ alt=”Land Cost” onclick=”window.wopen(‘HTML/landcostinfo.html’,”,’width=300,height=200′)” />
<%} else { %>
&pound;&nbsp;<input name=”LandCost” type=”text” id=’lc’ size=15 maxlength=25 value=”” onchange=”updateBox();” onkeypress=”return numbersonly(this, event)”/>
<img name=”landcost” src=”images/info.gif” hspace=”3″ alt=”Land Cost” onclick=”window.wopen(‘HTML/landcostinfo.html’,”,’width=300,height=200′)” />
<%} %>[/CODE]

Any ideas?

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@toicontienNov 21.2008 — What's not working?
Copy linkTweet thisAlerts:
@bldstrauthorNov 21.2008 — The onchange event isn't working in Firefox but is in IE6, Firefox just doesn't seem to be calling it at all. Only the onkeypress event works in Firefox.

It should show a form drop list that is hidden until a specific value in another drop list is selected. The lists are contained in a div and the CSS value is set to hidden until script changes it to display.

My colleague only works part time so I'm unable to ask her for any more detail right now, I wasn't sure if more info would be required, I was hoping it might be glaringly obvious from the script e.g. a syntax error.
Copy linkTweet thisAlerts:
@toicontienNov 21.2008 — The onchange event should only fire in Firefox when the text field loses focus.
×

Success!

Help @bldstr 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.30,
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,
)...