Hockey wrote: What I want to know is does something similar already exist? http://phrogz.net/tmp/FormAutoValidate/formautovalidate_docs.html[^] is a nice one, though it will make XHTML validation fail...
Bjoern Graf
Posts
-
Javascript form validation -
javascript error...Never ever submit a form
onchange
of a select! Reasons:- the user is not able to select options with the keyboard
- when the user uses the mouse wheel and the
select
has focus the form is again submitted by accident - the form will not be submitted if the user has JS disabled
Having that said here's another programatically correct approach:
<script type="text/javascript">
function doSubmit(frm) {
frm.submit();
}
</script>
...
<select onchange="doSubmit(this.form)"> -
Dynamic View Support DetectionWhile I'm not sure how the dynamic view feature for Mozilla is implemented I assume it to work for Safari, too. Ok, Safari ain't really the browser of choice for the intended audience, I'm currently forced to browse the web via MacOS X. And being a pedantic x-browser JS advocate (or something in this direction, greetings to irc://irc.efnet.net/#javascript), I'd like to see my favorite development site to do feature detection the right way, testing for feature support instead of browser version/name. This way, the site would support future browsers out-of-the box, too :cool:
-
Javascript textBut don't use an IE only DOM 0 thingy (hint:
document.all
) if it's possible to stay compatible with most (actually all) browsers by usingdocument.getElementById(id).innerHTML = text;
. -
opening new page in same windowGive the window a name, eg.
var myWin = open(pape, 'MyWindow');
. Later, when the main document hasn't changed, you can use the window object to open a new page (if(myWin && !myWin.closed) myWin.localtion.href = 'foo.html';
); form a different page, using open with the same name (MyWindow) will load the url into the same window. -
beginner questionSee Making Pop-up Windows Accessible[^] for valid (and good, if that is valid in conjunction with popups :cool: ) way todo popups.
-
javascripts helpThis would work if the fields all have the same name (serial in this example). But here the fields include an increasing number so he needs to use:
for(var i = x; i < y; i++) { document.formName["serial" + i]; }
where x is the number of the first field and y is the number of the last. -
how do I remove a node?Kinda expensive solution :) DOM1 defines the
removeChild
method, so why not use it:var parent = document.getElementById("anelement");
var child = document.getElementById("anotherelement");
parent.removeChild(child);IE DOM0 implements the
removeNode
method:var child = document.getElementById("anotherelement");
child.removeNode(true); -
JAVA SCRIPT fullscreen with no scrollbars and so on -
CSS with input elementsIn CSS2 one can match attributes (see Attribute selectors[^]). But IE doesn't support CSS2, one have to go with style classes :)
-
How to Perl script in Windows 2000 Pro?Have a look at ActiveStates[^] ActivePerl[^], which supports ISAPI, Perl in WSH and more.
-
Programmatically adding multiple functions to one event handler (JS)First, don't use eval. Never ever as it'll recompile the current script plus the stuff inside the eval :) To attach more than one event handler to an element, use the method attachEvent (IE) or for w3c browsers addEventListener[^]:
var el = document.getElementById("foo"); el.attachEvent("onclick", foo); el.attachEvent("onclick", function () { alert("2nd handler"); }); function foo(event) { alert("1st handler"); }
-
Abusing JavaScriptLogdar wrote: What do you think is it OK or it is very stupid idea? Yap, it's very stupid idea :cool: See http://www.tom.me.uk/scripting/[^] for the reasoning. Logdar wrote: Are there many people who use these browsers or disable JavaScript? http://www.thecounter.com/stats/2003/May/index.php[^]
-
The Hand Cursor in IE5.0Use both. Browsers that don't understand a css property are supposed to ignore that one, so
cursor: hand; cursor: pointer;
will do the trick. -
How to use format-number() function?I never tried it with a full XPath but I think you need to add apostrophs around the format string, e.g.:
<xsl:value-of select="format-number(<XPath>,'###.##&apos)" />
Hope this helps, Bjørn. -
IXMLDOMDocumentPtr and IXMLDOMDocument ?!?!They basicly the same. The COM interfaces without the trailing Ptr are the raw interfaces, while the ones with the ptr are smart pointers which free the COM object if the interfaces isnt referenced anymore.
-
My friend has written a function 831 lines long.I have to maintain a project that has been converted from VB to MFC :suss: And most of its functions have way more than 831 lines :omg:
-
CString with ATL/WTL 7.0It's quite obvious - and mentioned in the help for CStringT ;)
#include <atlstr.h>
Bjørn. -
Can someone please shoot me for my oversight?Project Properties->Linker Settings->Input->Additonal Dependecies Thats all :) Bjørn.
-
Is this the right place to curse the non-class wizard in VS.NET?Joe Woodbury wrote: How do you delete member variables like the VC6 class wizard did? Hmmm, a good design doesnt require to delete a memeber variable :cool: Seriously, go to the header file and remove it manually seems to be the only way :~ Joe Woodbury wrote: How do you view a list of the control IDs of a dialog and what member variables and messages have been associated with them? Select the class in class view, r-click -> properties and then click on the events button in the properties. Last words: Take a look at the "Where Are ClassWizard and WizardBar in Visual C++ .NET?" topic in the help files - the truth is out there :-D