On 1/20/2011 10:02 PM, BobH wrote:
<button type="custom" style="margin-top : 10px ;"
id="btnEdit"
onclick="setEdit()">Edit</button>
<button type="custom" style="margin-top : 10px ;"
id="btnSave"
onclick="setSave()">Save</button>
The issue here is that the <button> element is by default (at least in Firefox and Chrome
on Windows) has a submit action when clicked. So your background color change is happening (you
can test that out by adding an alert after the setting of the background color style
attribute), and then the form is submitting and since you don't have an action on the form the
page submits to itself showing you the "fresh" content of your page (as in without
the background color set).
Either change the type attribute of your <button> tag to type="button", or add a return
false to the onclick event onclick="setEdit(); return false" the former being preferred, with
not using obtrusive event handlers being even more preferred.
HTH
Danilo Celic
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/[email protected]/
To search via a non-Google archive, visit here:
http://www.mail-archive.com/[email protected]/
To unsubscribe from this group, send email to
[email protected]