If Programming Languages Were Real Persons: Mary JavaScript
Posted by tech on
December 4, 2009
Written by Kerasiotis Vasileios. What if programming languages were real persons like you and me? What if they were parts of families and had relations and affairs? Have you ever thought of going to a supermarket and Visual Basic was the young woman waiting in the line in front of you?
JavaScript is often confused with Java in Devel City especially from newcomers… but you know what they say that: “where no smoke without fire”. Many rumors say that JavaScript is Java’s half sister but she denies it, so does Java.
JavaScript is 32 and her close friends call her “JS”. She is very strict but relaxed also. This, makes her a wonderful companion for most of Devel’s residents and she is very popular since a large part of the city has used her services at least once.
JS is one of the most successful women in Devel City. She runs a network of more than 20 companies some of which are unique. jQuerysius, Mootool and Dojodic, to name a few are popping out each and every day.
She works silently and a lot of people think that she spents most of her time to make her job look glamourus. Most of her competitors say that she is good only for that but, to be honest, all of them know that there are some things that only she can accomplish.
She believes that to become successful, you have to keep your friends close and, your enemies closer. So, she tries to cooperate and coexist with all other businessman and businesswoman in Devel City. Everybody loves her even if she breaks things up sometimes.
Found this post useful? Donations appreciated. Every little $ helps.tags: javascript, language, programming
1 Comment
Javascript: Check If Popup Window Exists Using Its Window Name
Posted by tech on
September 11, 2009
When you create a popup window in Javascript, you use the function window.open(). The second parameter, refers to the window name which, usually is useful to avoid duplicates if you have a purpose of not having duplicates. Because of this property, the window name can be used to check if a popup window of that name exists or not.
Although there is no direct way to detect if a popup window with that name exists or not, what you can do is place the window name in an array object then browse the array’s contents to see if the window name exists or not.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | var winnames = new Array(); var ctr = 0; function doesPopupExist(window_name) { var exist = false; for (i=0; i<winnames.length; i++) { if (winnames[i] == window_name) { exist = true; break; } } return exist; } |
Adding the window name to the array object, you can do this.
1 | winnamess[ctr] = window_name; |
Then you can use the doesPopupExist() function to see whether the popup window with that name exists or not.
Found this post useful? Donations appreciated. Every little $ helps.tags: popup, window
5 Comments
How To Run AJAX Syncrhonously
Posted by tech on
August 2, 2009
SJAX (Syncrhonous Javascript and XML) is the opposite of AJAX. Sometimes we need to run things in a linear fashion. Doing so is easy. When you call the open() function to open the URL, just set the third parameter to false. Also, since we set it to false, there is no need to set up an onreadystatechange handler. Call the send() function right away and wait for the response returned by the server with the responseText variable. See code below.
1 2 3 4 5 6 7 8 9 10 | var xmlHttp; if (window.XMLHttpRequest) { xmlHttp = new XMLHttpRequest(); } else if (window.ActiveXObject) { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlHttp.open("GET", url, false); xmlHttp.send(null); alert(xmlHttp.responseText); |








