Recent Notes
Displaying keyword search results 1 - 10
Created by Dr. Xi on May 24, 2012 20:36:53
Last update: May 24, 2012 20:36:53
I have two sites: site1 and site2 . I want to render some content from site2 on site1 . The content is different depending on whether the user is logged in site2 . For example, display Login button when user is not logged in, My Account link when user is logged in. I can inject content into the page on site1 by including a JavaScript generated from site2 :
<script type="text/javascript" src="http://site2/c... This works because when the JavaScript is requested from site2 , the session cookie is sent along with the request, which is used by site2 to generate different content depending on the session status. However, for IE 9, this scheme breaks when site1 and site2 are in different security zones and IE protected...
Created by James on January 10, 2011 12:35:53
Last update: November 04, 2011 19:28:03
The events mouseover and mouseout are fired when the mouse enters/leaves the element where the event handlers are registered, and any nested elements which do not handle these events (because of event bubbling ). The events mouseenter and mouseleave are fired only when the mouse enters/leaves the specified element. Nested elements do not come into play. This following is a test page. You need Firebug to view the console output. Or use the JavaScript Executor bookmarklet. If none of these are available, an alert will popup (but you won't be able to fully test with alert.).
<!DOCTYPE HTML> <html> <head> <title>jQu... For the above test page, when you move the mouse through both the outer and inner areas of the mouseover/mouseout rectangle, the output is...
Created by James on March 02, 2011 12:29:38
Last update: March 11, 2011 08:42:50
jQuery event delegation allows you to bind event handlers to elements not yet created, under these conditions:
The DOM element must nest inside the element to which the event is delegated to
The inner element must not stop event bubbling
The opposite of delegate is undelegate .
<!DOCTYPE HTML>
<html>
<head>
<title>jQu...
Created by James on September 03, 2010 15:52:12
Last update: January 11, 2011 20:22:40
Use the siblings function to find all siblings of the current jQuery object:
$(this).siblings()
which is equivalent to:
$(this).parent().children().not(this)
Or, use an optional selector to further limit the selection of siblings:
$(this).siblings('li .hilighted')
Test page:
<!DOCTYPE html>
<html>
<head>
<title>jQu...
Created by James on July 19, 2009 20:51:23
Last update: January 11, 2011 20:14:18
If CSS3 border-image is properly supported, making a rounded corner box is very easy. You just need a round corner image like this: The following markup:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" ... would render like this (try it in Firefox 3.5 and Google Chrome): However, IE as of version 8.0 does not support border-image . So until border-image is reliably supported in all major browsers, we still have to rely on tried and true tricks to make it work. In general, I found three general categories of tricks to make rounded corners: Good old tables. This trick creates a table of 9 cells and uses the 8 cells on the perimeter to render the borders and rounded corners. The central cell is used for...
Created by Dr. Xi on September 02, 2008 18:55:18
Last update: January 18, 2010 22:36:24
Remember the times when you googled for solutions to your technical problems? How much time did you spend on wading through the zillions of links to find the ones that are of interest to you? Wouldn't you hope that you can find the answer right away the second time around? How many times were you forced to peruse hundreds of pages of documentation for a very specific need? Did you ever need to experiment with various alternatives because the documentation was vague? Wouldn't you prefer that a shortcut is available when the same thing is needed again? Xinotes is here to record your technical findings so that you won't have to go through the same process again when the problem reappears. Experience has taught us...
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 Dr. Xi on April 22, 2007 21:58:45
Last update: January 19, 2009 20:26:12
Your code will be syntax highlighted when you specify the language of your code with the BBcode code tag:
[code=lang] Your code here [/code]
where "lang" is the language of your code. For example, the following Perl code
#!/usr/bin/perl
print "Hello World!\n";
is rendered with:
[code=perl]
#!/usr/bin/perl
print "Hel...
The following are supported languages and their corresponding names for BBcode:
Apache conf: apacheconf, aconf, apache
Bash...
The full list is available from http://pygments.org/ , which is our backend engine for syntax highlight rendering.
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...
Created by Dr. Xi on August 10, 2007 20:43:10
Last update: August 10, 2007 20:43:10
IE and firefox both support client side XSLT.
This can be done by inserting an xml-stylesheet into the XML file, which would trigger the browser to apply the XSL to the XML document and generate a transformed page:
<?xml version="1.0" encoding="utf-8" ?>
<?...
Or, it can be done more dynamically with client side JavaScript. However, IE and FF offer different APIs for XSLT. Below is my attempt to bridge the differences. It's been tested to work for IE 7.0, FF 2.0 and Opera 9.0.2.
function XSLT(url) {
var xslt = false;
...
The following HTML page shows how to use it:
<HTML>
<HEAD>
<SCRIPT language="JavaS...