Get Selected Text


Example: get selected and put it in a form textarea Reference: http://www.codetoad.com/javascript_get_selected_text.asp <script language=javascript> function getSelText() {     var txt = '';      if (window.getSelection)     {         txt = window.getSelection();              }     else if (document.getSelection)     {         txt = document.getSelection();             }     else if (document.selection)     {         txt = document.selection.createRange().text;             }     else return; document.aform.selectedtext.value = txt; //or return the text … Continue reading Get Selected Text

Change page URL without refreshing page


Can we change page URL, eg. when sending an ajax request, or opening an image in a light-box? HTML5: Changing the browser-URL without refreshing page Reference: http://spoiledmilk.dk/blog/html5-changing-the-browser-url-without-refreshing-page An often overlooked feature of HTML5 is the new “onpopstate” event. This new feature offers you a way to change the URL displayed in the browser* through javascript without … Continue reading Change page URL without refreshing page

Using CakePHP without Database Connection


Is it possible to use CakePHP framework without using any database connection? YES Without much fanfare - here are the steps to trick CakePHP into believing that there is a database even when there is none! #1 Create a file called dbo_my_dbo_source.php in the directory app/models/datasources/dbo/ Put the following code in this newly created file … Continue reading Using CakePHP without Database Connection