Javascript

How to select the content of an input field

It's quite easy to select the content of an input field or a textarea whenever it's clicked or focus. You just simply call select() method in the onclick and onfocus event handlers of the input/textarea element. The function of select() method is to select the content of the element. Below is the sample HTML code.

Javascript Function สำหรับการทำ URL Encode

ในบทความเรื่อง Cross site scripting ผมต้องการเครื่องมือที่จะทำการ url encode ที่ซึ่งจะสามารถแปลงตัวอักษรทุกตัวรวมทั้ง Alphanumeric characters ด้วยผมจึงการทำการค้นหาจาก google ก็พบ Javascript Url encoder/decode จาก www.webtoolkit.info ซึ่งรองรับ UTF-8 encoding ด้วย แต่ฟังก์ชันดังกล่าวก็ไม่ได้เข้ารหัสตัวอักษรทุกตัว ผมจึงต้อง ฟังก์ชันดังกล่าวได้ Javascript code ด้านล่าง

ญาณรักข์ วรรณสาย
Syndicate content