Topic awaiting preservation: onclick to submit form from XHTML 1.1 doc |
|
---|---|
Author | Thread |
Paranoid (IV) Inmate From: 127.0.0.1 |
posted 07-07-2005 03:38
I've got an XHTML 1.1 doc, served with application/xhtml+xml MIME type. |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 07-07-2005 04:33 |
Paranoid (IV) Inmate From: 127.0.0.1 |
posted 07-07-2005 04:45
That didn't do it. It still just goes to the href. |
Paranoid (IV) Inmate From: France |
posted 07-07-2005 08:33 |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 07-07-2005 08:47 |
Obsessive-Compulsive (I) Inmate From: |
posted 07-07-2005 09:19
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 |
posted 07-07-2005 11:00
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 |
posted 07-07-2005 20:17
Slime - |
Paranoid (IV) Inmate From: London |
posted 07-07-2005 23:14
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. |