Get the element that triggered the event in an event handler function
Even before jQuery, vanilla JavaScript worked.
http://www.quirksmode.org/js/events_properties.html
| JavaScript | 0 comments | Tuesday, December 17, 2019 |
| JavaScript | 0 comments | Tuesday, December 17, 2019 |
Sometimes, when a user enters numbers into a HTML INPUT text field, he/she enters commas too for readability esp in the case of financial inputs.
But when we send the input data via a form to the backend script for storing into a database, say MySQL database, we don't want the commas in the SQL INSERT statement.
So here's a script to show the commas while typing and remove the commas on hitting the submit button.
| HTML, JavaScript | 0 comments | Sunday, April 28, 2019 |
Google Apps Script is JavaScript based scripting for many of Google's services, most noteably, Google Spreadsheets, like VB Macros for Excel.
There are some subtilities in JavaScript, like window and document not being defined. Though the scripting is mostly JavaScript, it is not 100% native JavaScript since it runs in an app and not in the browser.
Currently Google Apps Script has a computeHmacSha256Signature() function but Amazon's AWIS requires a SHA-1 key for its signature which can be obtained from jsSHA. I've clipped the jsSHA code from here as its too lengthy. You can download it from sourceforge, copy-paste the code from /src/sha1.js. A small change is required though. Change b64pad="" to b64pad="=".
| AWS, Google Apps, JavaScript | 0 comments | Sunday, December 05, 2010 |
Opera was the only browser that triggered the error function when an illegal cross-domain AJAX request was being tried via jQuery.
Internet Explorer just didn't fire any of the events - the debugger reported a security violation.
| AJAX, JavaScript | 0 comments | Monday, August 09, 2010 |
Flash & JavaScript examples of using markers & geocoding on Maps.
I've never been a big fan of Flash, given that that's what dominates the web design animation spectrum.
Agreed that you can make things look much cooler very easily using Flash, while achieving the same UI using JavaScript may take 10 times the effort. But this should change over time with the development of HTML5's canvas element.
With Google's Visualization Geomap API you can get the nice map interface that you've seen in Google Analytics.
But the Maps API is lighter and you can move it around & zoom using the mouse.


In both cases, storing Latitude/Longitude pairs offline and then geo-locating the same renders a whole lot faster.
| HTML, JavaScript | 0 comments | Saturday, June 12, 2010 |
| JavaScript | 0 comments | Monday, July 13, 2009 |
If you zooom in, you should be able to see the top and bottom border colours.
This happens in all canvas-supported browsers (FF 3, FF 3.5 beta 4, Opera 10 beta, Chrome 2 beta, Safari 4 beta).
Reason : https://developer.mozilla.org/en/Canvas_tutorial/Applying_styles_and_colors#section_8
Mozilla's canvas tutorial on drawing shapes shows a screenshot which has the inner most rectangle of exactly 1 pixel wide and colour black. But viewing the example itself in the browser, shows otherwise - 2 pixel wide with faded colours.
I've written a small function that draws exactly 1 pixel wide straight line parallel to the axis.
| Canvas, HTML, JavaScript | 1 comments | Saturday, May 23, 2009 |
In traditional OOP, if we wanted to get or set an object's private member, we would need to write a public method to do the job.
The reason behind making a member data private and then accessing it through a public method is to avoid the implementing-user to access it directly.
There can be many reasons for prohibiting direct access to member data to the implementing-code.
For example, you may want a radius of a Circle to be within the range of 10 - 500.
In languages like PHP & Python & PERL which have a weak type system, a further check of the data type may be necessary.
But for Python unfortunately even traditional getter & setter methods cannot be implemted because Python doesn't have a public or private. Everything is public by default - though a member can be made private by prefixing two underscores to it. But this is only for convention, it doesn't really serve its true purpose.
PHP 5 and C# .NET have a getter and setter method feature, making it look like we're accessing the data member directly.
C# .NET 3.0 has introduced Automatic Properties where you don't need to specify code for the getter & setter - the compiler takes generates the method body.
JavaScript does seem to have a getter and setter method which I came across just now when searching for the official source to Java 7's new features' documentation, but :
The Getter & Setter feature does not seem to be a much "wanted" feature in the Java community.
Still, this has been proposed by Rémi Forax for JDK 7.
| C#, Java, JavaScript, php | 0 comments | Monday, February 25, 2008 |
| AJAX, HTML, JavaScript | 2 comments | Tuesday, September 18, 2007 |
| C#, Java, JavaScript, php, Python | 0 comments | Wednesday, August 22, 2007 |