Wednesday, December 12, 2012

input type text place holder

This is how to put a placeholder on input type text using simple javascript.

<input type="text" name="FullName" id="Fullname" value="Name" onblur="if(this.value == ''){this.value = 'Name'}" onfocus="if(this.value == 'Name'){this.value = ''}" onclick="this.value==''">

Monday, December 10, 2012

no domain in a string url

This is how to display a string url without its domain name.


var thisUrl="http://domain.com/directory/subdirectory/file.name"
var noDomainUrl = thisUrl.replace(/https?:\/\/[^\/]+/i, "");

alert(noDomainUrl);