Skip to main content

CSS, Javascript functionality issue relating to styled input buttons on newer browsers? (IE 8/9, FF 9)



I'm working on a site where I have input buttons (styled using CSS) that are a part of a form. For example, see below for sample code







<input type="submit" name="buttonSave" value="save" id="buttonsavejs" class="button_image button_style"/>







I've just found an issue where if a user clicks on the button, it moves a few pixels below and then expected action takes place intermittently . But intermittent , I mean that sometimes it works (redirects the user to the next page) and sometimes nothing happens.





The developer who worked on this previously hasn't documented his code much, so I'm trying to work from scratch here (so excuse the lack of details). Anyway, after testing the code, it appears that the issue lies with how newer browsers are rendering the css and javascript.





Here's a snippet of the javascript behind the button's functionality:







$("#buttonsavejs").click(function(){

$("#main").unbind("submit").submit();







And the CSS that styles the button







.button_style {

height:28px;

margin-left:10px;

position:relative;

right:10px;

top:-23px;

width:100px;

}



.button_image {

background-image:url(http://some_image);

border-bottom-width:0;

border-color:initial;

border-image:initial;

border-left-width:0;

border-right-width:0;

border-style:initial;

border-top-width:0;

display:block;

font-size:1px;

line-height:1px;

outline-color:initial;

outline-style:none;

outline-width:initial;

overflow-x:hidden;

overflow-y:hidden;

position:relative;

text-indent:-9999px;

}







Also, I noticed a very similar question asked here: Why do mouse clicks not always work for styled input buttons?





Another piece of what I've been able to find out so far. In IE 9's developer tools, if I switch the Document Mode to anything other than IE 8 or 9, the button behaves as it should. So one line of thinking I have is to set the X-UA-Compatible to IE 7 and see if that resolves it as, apparently, that's how the document mode in IE works: IE8 browser mode vs document mode





Question : After testing in FF (earlier versions < 9.0), IE 7, I noticed that the button works as it should. But in FF 9, Chrome 16, IE 8/9, it behaves as described above. Has anyone run into a similar problem and any advice on what I should be watching out for?


Comments

Popular posts from this blog

Slow Android emulator

I have a 2.67 GHz Celeron processor, 1.21 GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android emulator should start fairly quickly on such a machine, but for me it does not. I have followed all instructions in setting up the IDE, SDKs, JDKs and such and have had some success in staring the emulator quickly but is very particulary. How can I, if possible, fix this problem?

CCNA 1 Final Exam 2011 latest (hot hot hot)

  Hi! I have been posted content of ccna1 final exam (latest and only question.) I will post the answer and insert image on sunday. If you care, please subscribe your email an become a first person have full test content. Subcribe now  Some question  have not content because this question have images content. So that can you wait for me? SUNDAY 1. A user sees the command prompt: Router(config-if)# . What task can be performed at this mode? Reload the device. Perform basic tests. Configure individual interfaces. Configure individual terminal lines. 2. Refer to the exhibit. Host A attempts to establish a TCP/IP session with host C. During this attempt, a frame was captured with the source MAC address 0050.7320.D632 and the destination MAC address 0030.8517.44C4. The packet inside the captured frame has an IP source address 192.168.7.5, and the destination IP address is 192.168.219.24. At which point in the network was this packet captured? leaving host A leaving ATL leaving...