Se afișează postările cu eticheta textarea. Afișați toate postările
Se afișează postările cu eticheta textarea. Afișați toate postările

marți, 15 noiembrie 2011

Javascript URL regex

Here's how i check and replace URL patterns in Javascript, with this neat URL regexp pattern:


var URL3_pat = /http:\/\/([\w\d\.\-]+)\.([a-z]{2,8})(($)|([\/\?\#]+$)|(([\/\?\#]+[\w\d\:\@\%\/\;\~\_\?\\\+\-\=\\\\\.\&\,]+)))/m;

r = t.replace(URL3_pat, '<a href="$&" target="out">$&</a>');


Huh? what do you think about this regular expression?

vineri, 28 octombrie 2011

TinyMCE add content - add HTML

Here's the plain simple method to insert some HTML into your tinyMCE *textarea*



html = '<br><br><a href="gourl"><img src="someimageurl" border=0 alt=""></a>';
document.getElementById('#elm1').tinymce().execCommand('mceInsertContent',false,html);


Where id_blog_body is your textarea's ID attribute.


<textarea id="elm1" class="tinymce"></textarea>