Archive

Archive for the ‘JavaScript’ Category

Initcap function in JavaScript

June 5, 2012 Comments off

<script language=”javascript”>

function Initcap(word) {
var retWord = word.substring(0,1).toUpperCase()
+ word.substring(1,word.length).toLowerCase();
return retWord;
}

</script>

Advertisements
Categories: JavaScript, Technical

Remove all spaces from a string in JavaScript

November 22, 2011 Comments off

String.split(‘ ‘).join(”);

Categories: JavaScript, Technical

split a string at every n-th character in javascript

September 27, 2011 Comments off

Syntax:

String.match(/.{1,n}/g);

Command:

“testing”.match(/.{1,2}/g);

Output:

te st in g

Categories: JavaScript, Technical

How to Change Text box fore/background/border color in Jabascript

text1.style.color=’red’ // foreground color
text1.style.backgroundColor=’green’ // background color
test1.style.border=’blue’ // border color

Categories: JavaScript, Technical

Change window position in Screen using JavaScript

Solution :
=======
     Using window.dialogTop and window.dialogLeft properties, window position can be changed in javascript

Example:
======
        window.dialogTop=”100px”
        window.dialogLeft=”100px”

Categories: JavaScript, Technical

Change window size in javascript

Solution:
======
        Using window.dialogHeight & window.dialogWidth properties, window size can be changed in javascript.

Example:
=======
         window.dialogHeight=”1000px”;
         window.dialogWidth=”800px”;

Categories: JavaScript, Technical

JavaScript “Combo box/Select Box”

How to clear/remove the values in Select Box using Javascript?

Ans:document.getElementById(‘SelectBoxName’).options.length=0;

Categories: JavaScript, Technical