Archive for the ‘Javascript’ Category

create a contextmenu with javascript & prototypejs in seconds

1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 4 out of 5)
Loading ... Loading ...
Tuesday, April 8th, 2008

Did you ever wanted to build a context menu like google does it? I have figured out an easy and quick way to achieve this with a small amount of CSS and 3 lines of javascript.

contextmenu.png

Click here for a demo
(more…)

Translate easily with JavaScript and the Google language API

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 4 out of 5)
Loading ... Loading ...
Wednesday, March 26th, 2008

wow, google recently released an API for their translation services called Google language API. Thats a good news but it even gets better! The api is really easy to use and applications can be boosted within minutes. The reference can be found here

Here is a quick example of how to translate something...

JAVASCRIPT:
  1. google.language.translate('my mum is swimming', 'en', 'de', function(result) {
  2.   alert(result.translation);
  3. });

and it gets better and even easier: its possible to let the API detect the language .. so nothing you have to take care about anymore.

JAVASCRIPT:
  1. google.language.detect('Deutsch ist auch eine Sprache',
  2.  function(result) {
  3.   alert(result.language);
  4. });

Further reading: An introduction to the language API and translation tools.

Now its time to come up with some nice little tools, widgets which use this service. "a user selects a paragraph an your page, clicks a button and suddenly the text is translated into the desired language".

Library with extensions for prototypejs and script.aculo.us

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...
Friday, December 21st, 2007

prototype extensions library Today i have found scripteka.com which is an awesome resource for prototype and scriptaculous extensions. It offers one of the best extensions around on a very clear and web2ish site. Currently they offer 88 extensions which include javascript calendars, password strength meters, reflection generators, image croppers, faders, .... Go to scripteka.com and look yourself what they offer. Its good stuff which is based on one of the best libraries out there.

Want to show your source code to someone else?

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5 out of 5)
Loading ... Loading ...
Monday, December 17th, 2007

Today i stumbled across a nice tool called Pastie. Pastie helps you if you want to show some bits of your source code to someone else. e.g. you need some help, advice (or you just want to show off with your code). You paste an excerpt of your code and pastie saves it for under a unique URL. Then you send this URL to the person you want to show the code. The big advantage here is that the syntax is nicely highlighted ... very nice for remote troubleshooting! I have created a code snippet for demonstration.

pastie.jpg
(i've used code sections to create more sections.)

ajaxed: Calling server side VBScript procedures from client side (equivalent to PHP xajax)

1 Star2 Stars3 Stars4 Stars5 Stars (45 votes, average: 4.58 out of 5)
Loading ... Loading ...
Monday, July 2nd, 2007

My last post (about an ASP RSS component) included a demonstration which made use of a cool ajax technique simply called "ajaxed". See the demonstration here again. If you play around you will recognize that there is no conventional postback and AJAX is up in here ;) I have developed a small "library" which easily allows you to call server side ASP VBScrtipt procedures from the client side. No low-level Ajax knowledge is required... (more...)

Web 2.0 balloon tooltip with prototype and scriptaculous

1 Star2 Stars3 Stars4 Stars5 Stars (8 votes, average: 3.75 out of 5)
Loading ... Loading ...
Tuesday, May 29th, 2007

A very nice balloon tooltip from BeauScott.com is another gift of the web 2.0 era. Look at the stylish appearance and enjoy...

Balloon tooltip (more...)

lazy stars within regular expressions

1 Star2 Stars3 Stars4 Stars5 Stars (6 votes, average: 4.67 out of 5)
Loading ... Loading ...
Thursday, May 10th, 2007

Today i stumbled across something really funny which is called "lazy star" and is used as a term within regular expressions. I did work on an expression and could not get it to work till i found the lazy "guy" which was the solution for the problem. (more...)

Generate JSON from VBScript (ASP) datatypes

1 Star2 Stars3 Stars4 Stars5 Stars (62 votes, average: 4.45 out of 5)
Loading ... Loading ...
Thursday, April 26th, 2007

When working with JSON it's nice to have a generator for your language which transforms all the datatypes from your chosen programming language into the JSON grammar so that you can use them within javascript. For a lot of popular languages it's done already (i suppose) but I haven't found one for classic ASP .. so here it comes. The following example quickly demonstrates what the goal is:

ASP:
  1. set RS = getRecordset("SELECT * FROM table")
  2. response.write((new JSON).toJSON("rows", RS))

A simple usage of JSON normally is that you create a page which outputs data as JSON as the only response. This page is called later from another page and the returned data is used within a javascript function (known as callback). So the snippet above gets some data from the database and stores it in an adodb.recordset which is passed then to the JSON generator and the result is printed on the page. The consuming page would like to access the data now as it originally was within the recordset. like this:

JAVASCRIPT:
  1. function callback(rows) {
  2.    for (i = 0; i <rows.length; i++) {
  3.       alert(rows[i].columName);
  4.    }
  5. }

read on to get the details... (more...)

FormWalker - walking through form fields with the enter key

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 3 out of 5)
Loading ... Loading ...
Monday, April 16th, 2007

In conventional business applications users are used to navigate through form fields just by using the "enter" key rather than using the "tab" key. Especially on forms where they bung in a lot of numeric data (e.g. sales) it's more common to use the numeric block (numlock) and therefore the "enter" key is more convenient to use ... cause there is no tab key. I've just written a short javascript snippet which solves this problem. I call it FormWalking. (more...)

Keep session alive with Javascript

1 Star2 Stars3 Stars4 Stars5 Stars (11 votes, average: 3.91 out of 5)
Loading ... Loading ...
Thursday, December 14th, 2006

Do you know the problem of huge forms where the user has to provide a lot of values? Sometimes it takes ages to fill out a form or the user just goes for a coffee or even two, leaves the form opened and comes back after two hours and finishes filling out the form. And then? Yeah then the server normally answers with a login screen because the session has expired. (more...)