Posted At : Nov 03, 2010 15:45 PM | Posted By : Ed Tabara
Related Categories: Other, JavaScript, jQuery

Based on the title "Must-Have Cheat Sheets for Web Designers"it's meant for Web Designers, but Web Developers will find interesting things too....

| 5549 Views | 6% / 0% Popularity


Posted At : Apr 23, 2010 17:15 PM | Posted By : Ed Tabara
Related Categories: ColdFusion, AJAX, JavaScript, jQuery

Yesterday a had to create a script where some cells in a html table would change their values based on changed values on the server. So, all it took is to set the timer and at given period of times to call a server side script and gather the info and then display it in right places. Below is a simplified version of this script. It will call a server script each secod and display the value in a DIV. The first script is the one that you will load in the browser: Current Time is: <div align="center" id="clockID"></div><script src="js/jquery.js"></script><script language="JavaScript"> $(document).ready(function() { var refreshId = setInterval(function() { $('#clockID').load('clock.cfm?rnd='+ Math.random()); }, 1000); }); </script> And the server-side script is:#TimeFormat(Now(), "HH:mm:ss")#...

| 10161 Views | 12% / 0% Popularity


Posted At : Dec 04, 2009 14:04 PM | Posted By : Ed Tabara
Related Categories: ColdFusion, AJAX, JavaScript, jQuery

Given Have a form with 3 fields: Zip(text field), City(text field), State(dropdown field).Problem description The user fills in the Zip. Then, when starting to fill the City, AutoComplete appear (from those that have filled Zip). When/If one is selected the Stateis filled automatically. Solution Nowadays there are many solutions for AJAX AutoComplete but i choosed the jQuery plugin from devbridge.com. It seem to work very well and on the site are given details on how to use it. So after incuding the library with creating the form:Zip:? ?City:? ?State:? selected>selected>#stateName# and ading the JS: i started to test it in order to move farther. And of course issues started. First problem was that the value from the Zip field was not passed to index.cfm?action=buyers.getCity. Instead of the value just entered was passed the one that was in the field at the start, so it wasn't exactly what i needed. Maybe there exist an easier way, i don't know, but after quite long play...

| 7056 Views | 8% / 0% Popularity


Posted At : Dec 09, 2008 19:59 PM | Posted By : Ed Tabara
Related Categories: JavaScript

We all time to time get visitors from Google Images and usually they just see our site in a frame, just copy the needed image and then forget about that site. Never wanted to have them REALLY land on your site? So they maybe finding something interesting there and becoming one of your repeated visitors? If so, there is a solution and it is dumb simple: Create refresh.js with the following code: if (window != top) top.location = self.location and put it say in the JS folder of your site. Then in the HEAD of your site place <script language="javascript" src="http://www.yoursite.com/js/refresh.js"></script> with the correct location to refresh.js. Done! Don't ask me if it in anyway break Google Policies or anything like that. I have NO IDEA about that, but i don't think it should. Plus, you can encode the JS anytime :)...

| 5778 Views | 7% / 0% Popularity


Posted At : Sep 26, 2008 0:44 AM | Posted By : Ed Tabara
Related Categories: Other, JavaScript

Ever wondered if your application could know when the client click BACK button in the browser so that the application to act accordingly? Well, it happen to be possible. After some googling and more tests and fails, here is what i came to. <script language="JavaScript" type="text/JavaScript"> <!-- window.onunload = backAlert(); function backAlert() { window.onbeforeunload = function () { if (true) { return "Warning! If you go back, your data will not be saved."; } } return false; } //--> </script> What it will do is to fire a confirmation alert when the back button will be hit. Actually it will fire that alert on some other events too, so for particular conditions you may want to alter the code. For example, if you have a form, the alert will appear on submit too. So, for this particular situation i would do the following: <form action="yourscript.cfm" method="post" name="frm" onsubmit="document.frm.tstfld....

| 9164 Views | 11% / 0% Popularity