![]() Topic awaiting preservation: onclick to submit form from XHTML 1.1 doc (Page 1 of 1) |
|
---|---|
Paranoid (IV) Inmate From: 127.0.0.1 |
![]() I've got an XHTML 1.1 doc, served with application/xhtml+xml MIME type. |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
![]() |
Paranoid (IV) Inmate From: 127.0.0.1 |
![]() That didn't do it. It still just goes to the href. |
Paranoid (IV) Inmate From: France |
![]() |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
![]() |
Obsessive-Compulsive (I) Inmate From: |
![]() Try attaching the onclick handler from JavaScript with addEventListener()/attachEvent() rather than using an inline handler; that's likely to help matters, and be more future-proof to boot because you don't have to change the HTML later. (Is onclick a recognised attribute in properly-compliant XHTML?) |
Paranoid (IV) Inmate From: London |
![]() I kinda agree with Kryogenix but I'm not sure if I'm thinking the same thing I'm thinking, seperate the behaviour from the content, just as you seperate the presentation from the content. using onclick attributes is much the same as using the style="" attribute. |
Paranoid (IV) Inmate From: 127.0.0.1 |
![]() Slime - |
Paranoid (IV) Inmate From: London |
![]() document.getElementById will work with the current generation of browsers, but instead of doing a browser test do a test by objects before running your code, therefor if the object exists in the DOM the browser will continue code: function myFunc(){ if(!document.getElementbyId()){ return false; else{ alert('yay it works') } } } It's explained properly in that link I gave you before to Jeremy Keiths website. |