submit with the enterkey often also doesn't sent the name and value of the submit button in IE. However, to rely on the value of the submit button is just plain silly; just check the request method in your script:
if ($_SERVER['REQUEST_METHOD'] == 'POST) {// a form has been posted
}
using name="submit" is newbeeish and has more disadvantages than advantages (ever ran into problems when you wanted to do a javascript submit on such a form? remove the name="submit" and it works - the name and value would not have been sent anyway even had it worked)
function mouseDownHandler(e) {
if (typeof e == 'undefined') e = window.event;
var id;
if (typeof e.target != 'undefined') {
if (e.target.nodeName == '#text') {
id = e.target.parentNode.id;
} else {
id = e.target.id;
}
} else if (typeof e.srcElement != 'undefined') {
id = e.srcElement.id;
}
MouseDown(new Point(e.clientX, e.clientY), id);
}
Probably not; it took me 3 years to get to the point of making this, and basically browsers aren't quite ready for it. Requirements are high, and there are bugs in certain browsers (Linux version of Mozilla for instance, and Safari/Konqueror) that make it unplayable (I'm trying to find work-arounds though).
DHTML at this level is just maturing, and this is just an example of taking it to the edge (and then the Lemmings fall over:) )
Sorry to contradict you; javascript is at this moment merely a common name for the ECMAScript implementations. ECMA (http://www.ecma-international.org/) is an organisation for standardisation simular to ISO. Javascript implementations (currently JScript5.5 in IE6 and JavaScript 1.5 in Netscape/Mozilla as wel as Actionscript for Flash) are all based upon the ECMAScript V3 standard.
The page you are referring to is obviously outdated (P100? NS4.x?); it is true that in the past there was no real standard for javascript (actually, Netscape invented it - originally called LiveScript) and there have been security issues. That however is a thing of the past...
submit with the enterkey often also doesn't sent the name and value of the submit button in IE.
// a form has been posted
However, to rely on the value of the submit button is just plain silly; just check the request method in your script:
if ($_SERVER['REQUEST_METHOD'] == 'POST) {
}
using name="submit" is newbeeish and has more disadvantages than advantages (ever ran into problems when you wanted to do a javascript submit on such a form? remove the name="submit" and it works - the name and value would not have been sent anyway even had it worked)
Allow me to rewrite this for modern browsers:
// my class
// what to do when a mouse button is pressed
// DOM 2 event handling
// IE5+ event handling
// IE4 event handling
<div style=width:500px; background:red; id=red>Red</div>
<div style=width:500px; background:green; id=green>Green</div>
<script type=text/javascript>
function Point(x, y) {
this.x = x;
this.y = y;
}
function MouseDown(pt, id) {
alert('x:' + pt.x + ' y:' + pt.y + ' id:' + id);
}
if (typeof document.addEventListener != 'undefined') {
document.addEventListener('mousedown', mouseDownHandler, false);
} else if (typeof document.attachEvent != 'undefined') {
document.attachEvent('onmousedown', mouseDownHandler);
} else {
document.onmousedown = mouseDownHandler;
}
function mouseDownHandler(e) {
if (typeof e == 'undefined') e = window.event;
var id;
if (typeof e.target != 'undefined') {
if (e.target.nodeName == '#text') {
id = e.target.parentNode.id;
} else {
id = e.target.id;
}
} else if (typeof e.srcElement != 'undefined') {
id = e.srcElement.id;
}
MouseDown(new Point(e.clientX, e.clientY), id);
}
</script>
Probably not; it took me 3 years to get to the point of making this, and basically browsers aren't quite ready for it. Requirements are high, and there are bugs in certain browsers (Linux version of Mozilla for instance, and Safari/Konqueror) that make it unplayable (I'm trying to find work-arounds though). DHTML at this level is just maturing, and this is just an example of taking it to the edge (and then the Lemmings fall over :) )
Sorry to contradict you; javascript is at this moment merely a common name for the ECMAScript implementations. ECMA (http://www.ecma-international.org/) is an organisation for standardisation simular to ISO. Javascript implementations (currently JScript5.5 in IE6 and JavaScript 1.5 in Netscape/Mozilla as wel as Actionscript for Flash) are all based upon the ECMAScript V3 standard. The page you are referring to is obviously outdated (P100? NS4.x?); it is true that in the past there was no real standard for javascript (actually, Netscape invented it - originally called LiveScript) and there have been security issues. That however is a thing of the past...