Recent Notes
Displaying keyword search results 21 - 30
Created by James on October 11, 2009 21:15:53
Last update: October 11, 2009 21:19:39
Many techniques for making rounded corners do not work well when the element being rounded is displayed on a background with a different color (or multiple colors).
Example 1: Nifty Cube with JavaScript
<html>
<head>
<base href="http://www.html.i...
Example 2: modx Simple Rounded Corner Box
<html>
<head>
<title>Round Corner</title>
...
Example 3: CSS3 (does not work in IE)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" ...
Example 4: This is one that actually works ! The nifty corner technique can be tweaked to be background friendly, although the JavaScript version didn't work for some reason.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" ...
Created by James on May 23, 2009 19:46:01
Last update: May 23, 2009 19:49:46
This topic comes up once in a while: I need to generate a random string in JavaScript to get around browser (IE) cacheing.
Method 1 (not really random, but a new value every millisecond):
function randomString() {
return '' + n...
Method 2 (generate a random alpha-numerical string):
function randomString(length) {
var chars =...
Created by James on May 03, 2009 20:25:10
Last update: May 03, 2009 20:25:10
Some interesting information about getting the value of tabindex with JavaScript:
http://www.fluidproject.org/pipermail/fluid-work/2007-December/001129.html
Especially, IE returns 0 when tabindex is not set, making it indistinguishable from where tabindex is set to 0.
Created by Dr. Xi on January 29, 2009 21:33:44
Last update: January 30, 2009 17:43:33
You can use applet , object , or embed tags to embed an applet in your HTML page. However, The applet tag is interpreted by both IE and Mozilla family of browsers. The applet tag won't automatically download a JRE if the Java Plug-in isn't already installed. The object tag works only for IE The embed tag works only for Mozilla family of browsers, i.e., Firefox. Use applet tag:
<applet code="MyApplet.class" width="200" ... Use object tag: <!-- latest JRE --> <OBJECT classid="clsid:... Use embed tag: <!-- highest JRE that supports MIME type ... Mixed object and embed tag: <object classid="clsid:8AD9C840-044E-11D1-B3E9... You need to use a different name for the Mozilla embed tag and use that name to refer to the applet...
Created by Dr. Xi on September 23, 2008 02:50:53
Last update: September 23, 2008 02:59:22
You can set browser options to dictate whether a popup should be opened in a new tab or a new window.
For IE, when you select "Let Internet Explorer decide how pop-ups should open" in the Tabbed Browsing Settings dialog, the popup will be shown in a new window when toolbar , menubar , or location is "no":
window.open("Sample.htm",null,
"height=200,...
For Firefox, a popup without toolbar, menubar or location bar will be opened in a new window even when you check "New Pages should be opened in: a new tab " in the Tabs options.
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 September 18, 2008 23:37:43
Last update: September 18, 2008 23:37:54
For IE:
Open "Internet Options" dialog
Select the security tab
Click the "Custom Level" button
Scroll from bottom up and find the "Scripting" section
Select "Disable" under "Active scripting"
For Firefox:
Select Options from the Tools menu
Click the Content tab
Un-check "Enable JavaScript"
Created by Dr. Xi on September 11, 2008 22:45:21
Last update: September 11, 2008 22:47:14
Use the onbeforeunload handler to display a warning before window close:
<html>
<head>
<script language="JavaScript">...
This works only for IE and Firefox.
Created by Dr. Xi on September 07, 2008 22:10:21
Last update: September 07, 2008 22:15:51
When you use window.open to open a page in a new browser window, the new window is not modal, i.e., focus on the new window can be lost when the parent window is clicked. IE provides window.showModalDialog but it doesn't have the full power of a real browser window, and it's IE specific. This is a JavaScript that makes the popup window modal. The central trick is to check focus periodically with window.setInterval and request focus when it's lost. In IE, when an input on the page gets focus, the window thinks that it lost focus and requests focus back, thus taking focus away from any input fields - making it impossible to enter data into input fields in the modal dialog. This problem is...
Created by Dr. Xi on September 07, 2008 21:14:46
Last update: September 07, 2008 21:14:46
In the simplest form, JavaScript debugging is simply looking at the JavaScript error messages. For IE, there's a yellow mark at the left bottom screen of the browser when a JavaScript error occurs. For Firefox, you need to enter javascript: in the address bar to see the JavaScript errors. These simple tools aren't enough when your JavaScript s become less simple. For IE, you can use the "Microsoft Script Debugger" or "Microsoft Script Editor", which comes with Microsoft Office. This is a pretty good tutorial on the subject: http://www.jonathanboutelle.com/mt/archives/2006/01/howto_debug_jav.html For Firefox, I use firebug , which not only allows you to debug JavaScript, but also to inspect the HTML, DOM and CSS on the page. I use it a lot to modify the CSS on...