This is the touchscreen version of the post:http://webtrick101.blogspot.com/2011/12/javascript-to-move-div-around-non.htmlI believe most browser in touchscreen mobile devices will be supported such as iPhone/iPad/Android. Blackberry won't be supported as it is running browser with very low level of compatibility.Here are the codes:<html><head><script type="text/javascript">var PositionFlag = 0;var p1;var p2;var p3;var p4;var pos_x;var pos_y;var diff_x;var diff_y;var move_x;var...
Monday, December 26, 2011
Javascript to Move a DIV around (non-touchscreen version)
Ever wonder how to use javascript to move a DIV around your web page? This fascinated me because it is so cool to make your web page to have the drag-and-drop feature.The trick is to use the onmousemove event listener on the body level. Here are the codes:<html><head><script type="text/javascript">var PositionFlag = 0;var p1;var p2;var p3;var p4;var pos_x;var pos_y;var diff_x;var diff_y;var mouse_x;var mouse_y;var once = 0;function UpdateXY(){ mouse_x = window.event.clientX;...
Monday, December 5, 2011
PHP Date and Time MySQL Management Recommendation
Things are simple if everyone lives in the same time zone. Things become complicated when we want to develop a system that is "international". Time zone is a very important for internet related applications. The following shows the method I like when inserting time and date into MySQL and retrieve from it:Insert date and time to MySQL$timezone = "2"; // Get the time zone from user, usually from POST data// Normalize Date/Time to Greenwich Mean Time (GMT) Zone// Use gmdate to format to...
Subscribe to:
Posts (Atom)