I tried implementing an AJAX call to retrieve the URL for a random photo to be displayed in a static html page.
A List Apart had a good article to get me started.
Getting Started with AJAX
Ran into a problem where IE implementation of XMLHttpRequest ActiveX Object automatically caches all GET requests. This wikipedia article about XMLHttp gave a workaround by inserting a dummy random parameter in the URL.
Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts
Saturday, April 01, 2006
Tuesday, March 21, 2006
DIVs and Javascript
I just discovered that I cannot manipualte multiple DIVs using Javascript's document.getElementsByName().
Apparently, there is no legal way of using the name attribute for such tags such as div or span, according to W3C HTML 4.01 specs. You must confine the usage of this attribute to such tags as input, img, frame, iframe, form, map, param, meta, object, A, select, applet, textarea, or button.
Click Here.
So remember to use document.getElementsByTagName() instead and go through all DIVs and check for a user-defined attribute to achieve your goal. Although this seems inefficient if you have a lot of DIVs, it's legal and the DOM model should be efficient enough to not cause too much processing time.
Also bear in mind that replacing document.getElementsByName() with document.getElementsByTagName() may not be backward compatible with some older browsers such as IE4.
Apparently, there is no legal way of using the name attribute for such tags such as div or span, according to W3C HTML 4.01 specs. You must confine the usage of this attribute to such tags as input, img, frame, iframe, form, map, param, meta, object, A, select, applet, textarea, or button.
Click Here.
So remember to use document.getElementsByTagName() instead and go through all DIVs and check for a user-defined attribute to achieve your goal. Although this seems inefficient if you have a lot of DIVs, it's legal and the DOM model should be efficient enough to not cause too much processing time.
Also bear in mind that replacing document.getElementsByName() with document.getElementsByTagName() may not be backward compatible with some older browsers such as IE4.
Wednesday, November 23, 2005
(Java) Autocomplete using AJAX
Here is an article about how to implement an autocomplete text box (that looks up field values in server database as user types) in a web form using JavaScript on client side and Java Servlets on server side.
http://java.sun.com/developer/EJTechTips/2005/tt1122.html#1
http://java.sun.com/developer/EJTechTips/2005/tt1122.html#1
Subscribe to:
Posts (Atom)