Recent Notes

Displaying keyword search results 1 - 10
Created by Dr. Xi on January 22, 2011 20:26:05    Last update: January 22, 2011 20:26:05
Deciding which one to use is not that easy. Chrome and Safari always use document.body.scrollTop , while IE and Firefox use document.body.scrollTop for quirks mode and document.documentElement.scrollTop for standard mode. Your best bet may be something like: var scrollTop = document.body.scrollTop || doc... Test page for quirks mode: <html> <head> <title>Quirks Mode</title> ... Test page for standard mode: <!doctype html> <html> <head> <title>Sta...
Created by Dr. Xi on October 26, 2010 04:47:37    Last update: January 11, 2011 20:00:36
The code presented here is a simple implementation of a tab set. It is used to demo how a tab set could be implemented. The code is stand alone and does not depend on any JavaScript libraries. Multiple tab sets within the same page is supported. The HTML markup is fairly simple: Tabs sets are contained within a DIV element with class name "tabsContainer". Define a UL list for the tabs. Follow the UL list with equal number of DIVs for the tab contents. The Nifty Corners Cube technique is used to draw the rounded corners (original form, not the enhanced JavaScript form). HTML, CSS and JavaScript: <!doctype html> <html> <head> <style typ...
Created by Dr. Xi on August 21, 2007 21:25:58    Last update: January 10, 2011 22:19:09
You can grab some animated icons here: http://mentalized.net/activity-indicators/ . And here's some code to demonstrate how to use such an icon. <html> <head> <script language="JavaScript"... However, if you use Ajax and send a synchronous request, the icon won't show up at all, i.e., the following code doesn't work: function eventHandler() { startBusy(); ... This works: function eventHandler() { startBusy(); ...
Created by Fang on April 01, 2010 22:24:58    Last update: April 02, 2010 02:49:38
In this note I'll show you how to create and package a JSP custom tag. The purpose of this tag is to display a random splash image for a home page, among a set of images. We should be able to add or delete candidate splash images from the WAR archive without the need to change the JSP. This is the intended use of the tag: <%@ taglib uri="http://custom.tag.com/demo" prefix... In the above example you provide a set of images named splash*.png (e.g., splash1.png, spalsh2.png, ...), and the tag will pick a random one to display when the JSP is rendered. Let's get started. I'll use Maven for this purpose. Create the standard Maven directory structure ./pom.xml ./src ./src/main ./src/main/jav... pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0"... SplashTag.java package tagdemo; import java.util.ArrayList......
Created by Dr. Xi on September 01, 2008 02:19:31    Last update: May 23, 2009 16:50:10
Use this bookmarklet to set or delete cookies in a web page. If you leave the expires date as is, the cookie will be deleted. Add this link to your bookmarks to install the bookmarklet. <html> <body> <a href="javascript:if (!windo...
Created by Dr. Xi on March 02, 2009 23:29:08    Last update: March 28, 2009 21:35:41
An HTML form contains more than what meets the eye. This bookmarklet displays information about form fields in the page. When there are multiple forms on the page, successive invocations of the bookmarklet display each form in turn. Add this link to your bookmarks. Here's the code: <html> <body> <a href="javascript: i...
Created by Dr. Xi on August 28, 2008 22:52:01    Last update: March 28, 2009 16:50:42
As a web developer, a lot of times I need to see the cookies in a page (and copy the value to another test program, sometimes). This is a bookmarklet to display the cookies. You may directly add this link to your bookmarks and name it "show cookies". It doesn't work in IE6 because of the JavaScript length limitations . However, you may try putting the script on a web server and importing it to the bookmarklet. <html> <body> <a href="javascript: i...
Created by Dr. Xi on August 14, 2008 22:44:53    Last update: September 29, 2008 21:41:40
Syntax: oNewWindow = window.open( [sURL] [, sName] [, sF... Example: window.open("Sample.htm",null, "height=200,... However, for IE7 (at least) the sName parameter can't have the space character: // this works window.open("sample.html", "wndCh...
Created by Dr. Xi on September 17, 2008 02:56:09    Last update: September 23, 2008 02:46:03
When a page is in a standalone window, window.focus() brings that page to the front. With tabbed browsing (in either IE, or Firefox), a popup window may be opened in a new tab. In that case, window.focus() has no effect. For testing purposes, this is the parent page: <html> <body> <script language="JavaScript"... and the popup page: <html> <body> <h2>The Popup</h2> </body>... I haven't found a solution to this when the popup is displayed in a tab. However, you can configure the browser so that it displays popups in a new window instead of a new tab. For IE, open up " Internet Options ", on the general tab under the " Tabs " section, click " Settings ". Under "When a popup is encountered", check...
Created by Dr. Xi on December 12, 2007 20:30:01    Last update: December 12, 2007 20:32:23
This is a script to tail a log file through the web browser. It uses AJAX, apache web server, mod_python, UNIX utilities tail (requires the --lines switch) and wc . The log file may reside on the web server or any other host accessible from the web server through SSH. Although it's written in python, it should be easy to port to other languages such as Perl. Apache httpd.conf : LoadModule python_module modules/mod_python.so ... Python script: import time, os from os.path import basename ...
Previous  1 2 Next