Archive for JavaScript

using underscore string…

(string…).stripTags();

Advertisements

Leave a Comment

JavaScript – Find out where alert from

You can overwrite alert, and create an Error for the stack trace:

var old = alert;

alert = function() {
  console.log(new Error().stack);
  old.apply(window, arguments);
};

Leave a Comment

JS Popup window remove vertical bar

add css:

body, html {overflow:hidden}

Leave a Comment

jQuery plugin tutorial

Leave a Comment

Free online mini dictionary

mini dictionary is a bookmarklet with some simple tools you can use on any website.

To Install

For IE Browser (version > 6.0)

  1. Drag this to your bookmarks bar (favorites bar or links bar): mini dictionary
  2. Select the following code then press Ctrl+C
    javascript:(function(){function%20loadScript(a,b){var%20c=document.createElement(‘script’);c.type=’text/javascript’;c.src=a;var%20d=document.getElementsByTagName(‘head’)[0],done=false;c.onload=c.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState==’loaded’||this.readyState==’complete’)){done=true;b()}};d.appendChild(c)}loadScript(‘http://ajax.googleapis.com/ajax/libs/prototype/1.6.1.0/prototype.js’,function(){loadScript(‘http://www.usitd.com/wia/js/effects.js’,function(){loadScript(‘http://www.usitd.com/wia/js/dragdrop.js’,function(){loadScript(‘http://www.usitd.com/wia/js/bm.js’,function(){test()})})})})})()
  3. Right-click on the bookmark made in step 1 and select “Properties”. In the “URL” field of the “Web Document” tab, press “Ctrl-V” to paste the copied link. Press “OK” to finish.

For Other Browsers

  1. Drag this to your bookmarks bar: mini dictionary

To Use

  1. Go to a website.
  2. Click the “mini dictionary” bookmark.
  3. Double-click on any word on the page, and a mini dictionary will pop up.
  4. Click anywhere outside of the pop-up to close the mini dictionary.

Leave a Comment

View Ajax Souce Code

IE:

  1. Create a bookmark in the browser
  2. Copy the following code in the url
    javascript:'<xmp>’ + window.document.body.outerHTML+ ‘</xmp>’
  3. Every time you want to see the page source code including Ajax, click it.

FireFox:

Select the content and “View selection source”

Leave a Comment

How to call a javascript function in the iframe?

document.getElementById(‘frame_id’).contentWindow.function_name()

Leave a Comment

Older Posts »