Theory and Practice
About Archives Categories Tags Authors 中文 ไทย
  1. Categories
  2. JavaScript

[JavaScript] Sieve of Eratosthenes

April 28, 2018

JavaScript implementation of Sieve of Eratosthenes.

 read more »

[JavaScript] Check if Value of Input Text Field is Integer

April 23, 2018

check HTML text input field to see if the value is integer.

 read more »

Get Instagram Profile Picture in Full Size

March 18, 2018 (Updated: March 23, 2018)

Given the url of Instagram profile picture, return the url of profile picture in full size.

 read more »

[JavaScript] Set Difference of Two Arrays

March 15, 2018

Find set differecne of two arrays, i.e., the elements in one array but not in the other, in JavaScript.

 read more »

[JavaScript] Union of Two Arrays

March 13, 2018

Find the set of all elements (union) in two arrays in JavaScript.

 read more »

[JavaScript] Intersection of Two Arrays

March 12, 2018

Find common elements (matches, intersection) of two arrays in JavaScript.

 read more »

JavaScript Wait Page to be Loaded

February 23, 2018

When web pages are rendered with JavaScript, how to wait until the DOM nodes of original contents are available for appending our nodes?

 read more »

[JavaScript] Convert Text to Link in HTML

January 12, 2018

Convert specific texts to clickable links (<a> tag) in HTML document via JavaScript.

 read more »

[JavaScript] Append Text at the Beginning of Each Line

January 11, 2018

Append text at the beginning of each line via JavaScript.

 read more »

[JavaScript] Tooltip with Close Delay

January 08, 2018

Show tooltip when the cursor hovers over the text, and close the tooltip with delay if the cursor is not in the tooltip via JavaScript.

 read more »

[JavaScript] Tooltip

January 06, 2018

Simple tooltip implementation via JavaScript.

 read more »

[JavaScript] Show Note on Mouse Hovering Over Text

January 04, 2018 (Updated: January 05, 2018)

Show annotatoin (note) on mouse hovering over text. Used to help users read ancient Buddhist texts.

 read more »

[JavaScript] Visit All Sibling Elements or Nodes

May 30, 2017

DOM manipulation - traverse all sibling elements or nodes via JavaScript.

 read more »

[JavaScript] Tab Panel

May 28, 2017

Tab panel implementation via JavaScript and CSS.

 read more »

[JavaScript] Accordion (Collapsible Content)

May 24, 2017

Accordion (collapsible content) implementation via JavaScript.

 read more »

[JavaScript] Modal (Popup)

May 13, 2017

Modal (Popup) implementation via JavaScript and CSS. Modal is dialog box/popup window that is displayed on top of the current page.

 read more »

[JavaScript] Find All Visible Texts on Web Page

May 02, 2017

Traverse DOM tree to grab visible texts on webpage via JavaScript.

 read more »

[JavaScript] Traverse DOM Tree

May 01, 2017

Traverse DOM tree to find out all text nodes via JavaScript.

 read more »

[JavaScript] Test Text-to-Speech in Web Speech API

April 22, 2017

Test Text-to-Speech feature in Web Speech API. Not working in Chromium 57, but OK in Firefox 53.

 read more »

[JavaScript] Draw Grid of Dots using Canvas

April 18, 2017

Exercise to draw 3x3 grid of dots via Canvas.

 read more »

JavaScript Empty an Array

March 25, 2017

My favorite way to empty an array in JavaScript and why.

 read more »

[JavaScript] JSONP Example

March 16, 2017

JSONP example - show your HTTP request headers.

 read more »

[JavaScript] Typing Text Effect

March 08, 2017

Sequential typing text effect by JavaScript.

 read more »

[JavaScript] Type Text Effect

March 07, 2017 (Updated: March 08, 2017)

Parallel typing text effect by JavaScript.

 read more »

[JavaScript] Show Quiz After End of YouTube Video

March 03, 2017

Quiz will appear at the end of YouTube video.

 read more »

[JavaScript] Show Content If Pass Quiz

March 02, 2017

Show youtube video if users pass the quiz.

 read more »

[JavaScript] Toggle (Show/Hide) HTML Element

February 26, 2017

Toggle (Show/Hide) HTML DOM element in JavaScript.

 read more »

JavaScript Arrow Key Example via event.key in Keyboard Event

February 14, 2017

Detect arrow keystrokes via event.key of KeyboardEvent in JavaScript.

 read more »

[JavaScript] Virtual Keyboard

January 28, 2017

Virtual kayboard/keypad in vanilla JavaScript. Used in Pāli Dictionary.

 read more »

[JavaScript] Setting Implementation via JSON and Web Storage (localStorage)

January 16, 2017

Implementation of setting feature in web application via JSON, Web Storage (localStorage), and JavaScript.

 read more »

[JavaScript] Generate Random String From [a-z0-9]

January 14, 2017

Generate a random string from [a-z0-9] in JavaScript.

 read more »

[JavaScript] window.location Example - Access Browser URL

January 09, 2017

Example of accessing browser URL via JavaScript window.location.

 read more »

[JavaScript] HTML Web History API Example

January 04, 2017

Change browser URL without reloading web pages - Example for how to use HTML history API.

 read more »

Search Taobao.com

May 06, 2016

Search Taobao.com.

 read more »

GitHub Pages Custom 404 Page with Redirect Link

May 02, 2016

Custom 404 page for GitHub Pages. In the 404 page, a redirect link is created based on the current URL path.

 read more »

[JavaScript] Copy to Clipboard

April 09, 2016

Copy content of textarea to clipboard via JavaScript.

 read more »

Search PTT BBS

April 07, 2016

Search PTT BBS.

 read more »

Search Links of Major Search Engines

April 03, 2016 (Updated: February 24, 2017)

Search links of major search engines - Google, DuckDuckGo, Bing, Yahoo, Baidu, Yandex, Ecosia, Qwant.

 read more »

[JavaScript] Wrap Pāli Words in Span Element

April 02, 2016

Wrap Pāli words in span element via regular expression and JavaScript.

 read more »

Photos of Me on Facebook

March 24, 2016

Find photos of me on Facebook.

 read more »

[JavaScript] Button For Traditional/Simplified Chinese Conversion on Website

February 29, 2016

Conversion Button of Traditional/Simplified Chinese on Website via JavaScript.

 read more »

[JavaScript] Font Size Larger/Smaller

February 27, 2016

Make font size of your website larger/smaller via JavaScript.

 read more »

[JavaScript] Bug in Succinct Trie Implementation of Bits.js

February 02, 2016

Fix the bug in succinct trie implementation of Bits.js - Wrong trie insertion if words are not inserted in alphabetical order.

 read more »

[JavaScript] Parse Accept-Language in HTTP Request Header

January 22, 2016

Parse Accept-Language in HTTP Request Header in JavaScript Programming Language.

 read more »

Use Object Instance Function as JSONP Callback Function

February 20, 2015

Cross-domain requests by JSONP with object instance function as callback on Google App Engine for Python.

 read more »

JSONP with Anonymous Callback Function

February 20, 2015 (Updated: February 20, 2015)

Cross-domain requests by JSONP with anonymous callback function on Google App Engine for Python.

 read more »

JSONP on Google App Engine Python

February 20, 2015 (Updated: February 20, 2015)

Cross-domain requests by JSONP on Google App Engine for Python.

 read more »

Draggable Toggleable Simple Web Keyboard

February 16, 2015

Demonstrate how to make an online 0-9 keypad, which is draggable via jQuery and toggleable via vanilla JavaScript.

 read more »

Hide Div When Clicked Outside It

February 13, 2015 (Updated: February 02, 2017)

Hide div element when clicked outside it, in vanilla JavaScript way. No jQuery or libraries are used.

 read more »

Javascript Drop Down Menu

February 13, 2015 (Updated: February 02, 2017)

Dropdown menu using vanilla JavaScript. No jQuery or libraries are used.

 read more »

[JavaScript] Toggle (Play/Pause) Sound on Click Event of DOM Element

October 12, 2012 (Updated: February 25, 2015)

Toggle sound on click event of DOM element.

 read more »

[JavaScript] Load CSS Dynamically

October 10, 2012 (Updated: February 23, 2015)

Load CSS file dynamically.

 read more »

[JavaScript] Remove Leading and Trailing Whitespaces

October 09, 2012 (Updated: February 22, 2015)

Remove leading and trailing whitespaces of a string in JavaScript.

 read more »

[JavaScript] Play Sound on Click Event of DOM Element

October 08, 2012 (Updated: February 25, 2015)

Play sound on click event of DOM element.

 read more »

[JavaScipt] Cross-Browser HTTP POST Request

October 05, 2012 (Updated: March 02, 2015)

JavaScript cross-browser HTTP POST request

 read more »

[JavaScipt] Cross-Browser HTTP GET Request

October 05, 2012 (Updated: March 02, 2015)

JavaScript cross-browser HTTP GET request

 read more »

DOM Ready without JavaScript Frameworks

October 04, 2012

Check DOM readiness in vanilla JavaScript.

 read more »

[JavaScript] Conversion of Traditional and Simplified Chinese

October 03, 2012

JavaScript library New Tong Wen Tang for conversion of Traditional and Simplified Chinese.

 read more »

[JavaScript] Firing Order (Precedence) of Event Handler

October 03, 2012 (Updated: March 03, 2015)

Use onmousedown event instead of onclick event if the event handler to be fired before onblur event.

 read more »

[JavaScript] Load Favicon Dynamically

October 02, 2012 (Updated: February 23, 2015)

Load website icon (favicon) dynamically.

 read more »

JavaScript basename()

October 02, 2012 (Updated: February 20, 2015)

JavaScript equivalent of basename program.

 read more »

[JavaScript] onMouseEnter and onMouseLeave Suppport for Old Browsers

October 02, 2012 (Updated: February 26, 2015)

JavaScript Cross-Browser Implementation of onMouseEnter and onMouseLeave Event

 read more »

[JavaScript] Change Scope (Context) of Anonymous Function

October 01, 2012 (Updated: March 07, 2015)

Change the scope (context) of anonymous function - change what this keyword refers to in anonymous function.

 read more »

[JavaScript] Scope (Context) of Event Handler Function

October 01, 2012 (Updated: March 07, 2015)

Discuss the scope (context) of event handler and how to change what this keyword refers to.

 read more »

[JavaScript] oninput and onpropertychange Event Alternative

September 30, 2012 (Updated: February 22, 2015)

Detect the content change of HTML input elements in a cross-browser and consistent manner.

 read more »

[JavaScript] Single Callback For Multiple Asynchronous AJAX Requests (XMLHttpRequest)

September 29, 2012 (Updated: March 20, 2017)

JavaScript single callback for multiple asynchronous XHR requests.

 read more »

[JavaScript] Check Website Availability and Then Redirect by JSONP

September 28, 2012 (Updated: March 25, 2015)

Redirect users to another website if the website is available.

 read more »

[JavaScript] String startswith, endswith and contains Implementation

September 27, 2012 (Updated: February 20, 2015)

JavaScript equivalent of Python string startswith, endswith, and contains.

 read more »

JavaScript Create DOM Element Dynamically

September 26, 2012 (Updated: February 20, 2015)

Create DOM elements by JavaScript.

 read more »

JavaScript Remove All Children of a DOM Element

September 26, 2012 (Updated: March 25, 2017)

Bug-free way of removing child nodes of a DOM element in JavaScript.

 read more »

JavaScript Cross-Browser Cross-Domain XMLHttpRequest (XDomainRequest in IE)

September 25, 2012 (Updated: March 20, 2017)

Cross-domain AJAX requests

 read more »

[Javascript] Width Percentage to Pixel

September 23, 2012 (Updated: February 26, 2015)

1% width of browser window equal to how many pixels?

 read more »

[JavaScript] Width of Browser Window in Pixel

September 16, 2012 (Updated: February 26, 2015)

Width of browser window in pixel.

 read more »

[JavaScript] Comparison of MouseEnter MouseLeave MouseOver MouseOut

August 07, 2012 (Updated: February 26, 2015)

Compare mouseenter, mouseleave, mouseover, and mouseout events.

 read more »

Lightweight Dynamic JavaScript Loader with Dependency Handling

July 25, 2012 (Updated: April 03, 2015)

Load JavaScript scripts dynamically with dependencies.

 read more »

AJAX Form POST Request to Google App Engine Python

July 24, 2012 (Updated: March 02, 2015)

Send/receive data to/from Google App Engine Python servers by HTTP POST requests in AJAX way.

 read more »

JavaScript Drag and Drop (Draggable, Movable) Element without External Library

July 13, 2012 (Updated: February 20, 2015)

Draggable, movable HTML element using vanilla JavaScript.

 read more »

Google Closure Library Editor with Equation Editor Dialog

July 08, 2012 (Updated: April 06, 2015)

Rich text editor with math equation dialog using Google Closure Library.

 read more »

JavaScript DOM Element Position (Scroll Position Included)

July 01, 2012 (Updated: February 18, 2015)

Get DOM element position (including scroll position) using JavaScript.

 read more »

JavaScript Back to Top Link

June 27, 2012 (Updated: April 06, 2015)

JavaScript Back to Top Link

 read more »

JavaScript Keyboard Event (Arrow Key Example)

June 25, 2012 (Updated: October 08, 2018)

Detect arrow keystrokes in JavaScript.

 read more »

JavaScript Event Target Element (srcElement)

June 21, 2012 (Updated: April 07, 2015)

Event target element in JavaScript event handling.

 read more »

Load External JavaScript or CSS file Dynamically

June 18, 2012 (Updated: February 23, 2015)

Load JavaScript or CSS on demand.

 read more »

JavaScript Prefix Match (Dictionary Application)

June 14, 2012 (Updated: February 24, 2015)

Given a set of strings (words), and an user input string, output a set of strings with prefix the same as the user input string

 read more »
Powered by Github Pages, Pelican, pyScss.