To execute a function inside in external .js file

To execute a function inside in external .js file, use $( window ).load. $(document).ready(function(){ is used to load .js file or loading js functions but those functions won’t be execute. create set_user_status.js file, it looks similar to this: function setUserStatus(v1,v2,v3){ alert(v1+ v2+ v3); //or console.log(v1+ v2+ v3); } The header will preload the external .js file like this: <script type=”text/javascript” src=”js/set_user_status.js”></script> To execute the function setUserStatus inside the external .js file, use $( window ).load $( window ).load(function() {//works setUserStatus( “value1”, “value2”, “value3”); });

Continue reading »

Keyboard code “KeyCode” and how to use it in JavaScript

To work on HTML5 canvas to develop a tool similar to paint or free draw on an image, JQuery and Javascript are often used on the browser client side to perform simple tasks that would otherwise require a full postback to the server. There’re a set of keycode associated with each character on the keyboard. To use this on your canvas on an html page, add JQuery and JavaScript to detect the key that user pressed as follow: Key Code backspace 8 tab 9 enter…

Continue reading »

How to detect screen resolution

PHP does not provide native function that can detect the device display resolution. Java Script can be used in this case, which will detect the display resolution. The script will do so, by using the width and height features of the screen. The required code for this has to be inserted into a HTML document. Once it is done, the settings can be switched to the PHP script through proper coding methods. This will be the codes that you can use to make your website…

Continue reading »