Archive for the ‘JavaScript’ Category.
December 3, 2009, 10:34 AM
Some times we really need to fool people to get more time to work, or just some of you want to play more video games…
For all of us we can always use the IT excuses generator ;)

To use it in your site c&p this:
<script type="text/javascript" src="http://lab.neo22s.com/ITexcuses/itexcuses.js"></script>
<div id="display_excuse" style="cursor:pointer;" onclick="displayExcuse();">When does the project end?</div>
Example:
When does the project end?
Other excuses generators:
November 30, 2009, 12:14 PM
Last day I show you how to change the value of a select in html, but what if you need to change many at same time?
I did this function to handle it:
Demo | Download
function changeSelectValues(theController,theElements) {
theElements = theElements.split(',');
for(var z=0; z<theelements .length;z++){
theItem = document.getElementById(theElements[z]);
if(theItem.type){
if (theItem.type=='select-one') {
theItem.value=theController.value;
}
}
else {
theInputs = theItem.getElementsByTagName('select');
for(var y=0; y<theInputs.length; y++){
if(theInputs[y].type == 'select-one' && theInputs[y].id != theController.id){
theInputs[y].value = theController.value;
}
}
}
}
}In the first param, normally you would write this. Second parameter is a list delimited by coma (“,”) to specify from where you want to change the selects.
Example to change all the selects from a div call “selects”: Continue reading ‘jsSelect – Multiple select value modifier’ »
November 22, 2009, 9:04 PM
This JavaScript function allows you to set the value of a select tag without having to know its position in the list.
function setValueSelect(SelectName, Value) {
SelectObject = document.getElementById(SelectName);
for(index = 0; index < SelectObject.length; index++) {
if(SelectObject[index].value.toLowerCase() == Value.toLowerCase()) SelectObject.selectedIndex = index;
}
}Usage Example:
<select id="clang">
<option value="arabic">Arabic</option>
<option value="english">English</option>
<option value="french">French</option>
<option value="persian">Persian</option>
<option value="turkish">Turkish</option>
</select>
setValueSelect("clang", "persian");This selects the persian value in the select.
November 12, 2009, 2:30 PM
Simple JavaScript function that returns true if is an array or false if it’s not ;)
function isArray(obj) {
if (obj.constructor.toString().indexOf("Array") == -1)
return false;
else return true;
}October 26, 2009, 10:58 AM
What about having a full screen Google Maps APP?
It should be not so difficult, but what if we add street search, mouse wheel zoom, maps redimension and street view?
Example:(check source code for full implementation)

How does it work:
To have Google Maps in full screen we need a a bit of css+HTML:
Continue reading ‘Google Maps full screen’ »