Client-Side Development Section Index | Page 9
How can I maintain a single instance of an object in an applet?
In start(), instead of always creating a new object, return the existing one if it exists or create a new one if it doesn't.
After calling the getAudioClip() method of Applet, when is the AudioClip loaded?
Until you try to play an audio clip, the AudioClip is not loaded.
How do I access all elements of a certain type?
function setCheckBox(checked)
{
var objEle = document.all.tags("input");
for (var i=0;i<objEle.length;i++)
{
if(objEle[i].getAttribute("type") == 'checkbox')
objEle[i].setAttribute("ch...more
How do I detect the IP address of the viewer when he/she is trying to access my page?
You can't do this from JavaScript, but if your server supports JSP, you can use the 'request' object to get this information.
Sample code:write this code in the beginning of your jsp
<%
Stri...more
How do I limit the number of characters entered into a text field?
Use MaxLength attribute of the Text field.
Example:
<INPUT type="text" id=text1 name=text1 maxLength=10>
When I use window.print(), a confirmation dialog appears. How can I print from JavaScript without getting the print dialog?
JavaScript doesn't support the behavior you are after.
How can applets from different codebases on the same HTML page communicate with each other?
You can use JavaScript and LiveConnect as a bridge. Let's say you have applet A and applet B. You should write 2 JavaScript called sendMessageToA(var s) and sendMessageToB(var s). Then applet A ca...more
How can I attach the jdb debugger to an applet running in the Java Plug-in?
Details are available from http://java.sun.com/j2se/1.4/docs/guide/plugin/developer_guide/debugger.html. Basically, you need to setup some configuration options within the Plug-in control panel be...more
How do I package Java extensions with applets? Do I have to unjar them and rejar them with the applet JAR file?
In the manifest file for the JAR file which loads the applet, you can specify an Extension-List attribute. Then, for each extension, there is a series of lines to add for each. One of these lines ...more
If my applet needs multiple JAR files, is there any way to optimize the download?
Consider indexing the .jar file. See http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#JAR Index for more information about indexing. Basically, use the -i option when you create the JAR file.more
What is Glasgow?
Glasgow is an early code name for the JavaBeans version after Java 1.1.
It allows developers to create more sophisticated JavaBeans components offering better integration with their runtime envir...more
How can I get an image to fade?
Fading can be done be the Opacity Settings. Actually opacity is one of the attribute in the Filter Property of the Casacading Style Sheets
Sample Code
<HTML>
<BODY>
<img src=...more
How can I use drag and drop within my web pages?
There is an example of using D&D within IE and Netscape at http://tech.irt.org/articles/js204/ and http://developer.netscape.com/docs/examples/dynhtml/dragable/, respectively.more
How do I assign global varaibles in a .js file?
All the variables declared between <script> and </script> tags that are independent of any functions defined are initialized before onLoad() function of the page. These are nothing but...more
I have a few paragraphs where I want to provide meaning to certain words in the paragraph i.e., when the user moves the mouse over the certain word I want to display the meaning of the sentence.
I have a few paragraphs where I want to provide meaning to certain words in the paragraph i.e., when the user moves the mouse over the certain word I want to display the meaning of the sentence. I ...more