JS Quicktags


I’ve released the JavaScript Quicktags used in Tasks Pro™, Tasks and WordPress under the LGPL license.

This is a set of buttons that allow you to insert HTML tags into a content area. The tags are cursor aware – placed around a selection or at the cursor position. This is also an example of how to get the cursor position with JavaScript.


Example Page


A sample insertAtCursor function:


function insertAtCursor(myField, myValue) {
//IE support
if (document.selection) {
myField.focus();
sel = document.selection.createRange();
sel.text = myValue;
}
//MOZILLA/NETSCAPE support
else if (myField.selectionStart || myField.selectionStart == '0') {
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
myField.value = myField.value.substring(0, startPos)
+ myValue
+ myField.value.substring(endPos, myField.value.length);
} else {
myField.value += myValue;
}
}

// calling the function

insertAtCursor(document.formName.fieldName, 'this value');









JS Quicktags : alexking.org: JS Quicktags






01 Nov 2013

0 komentar:

Posting Komentar

silahkan komentar

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.

Luncurkan toko Anda hanya dalam 4 detik dengan 
 
Top