Archive for the ‘Javascript’ Category

Javascript onEnter

Code

<script language=”JavaScript”>

NS4 = (document.layers) ? true : false;function checkEnter(event)

{

var code = 0;

if (NS4)

code = event.which;

else

code = event.keyCode;

if (code==13)

document.myform.submit();

}

</script>
Example

<input name=”Username” onKeyUp=”checkEnter(event)” type=”text” />

Javacript validate flie type

Code

<SCRIPT LANGUAGE=”JavaScript”>

if((document.form1.upload.value.lastIndexOf(”.jpg”)==-1) {
alert(”Please upload only .jpg extention file”);
return false;
}

</SCRIPT>

Add to favorites (Firefox & IE)

Header
</script>

<script type=”text/javascript”>

function bookmarksite(){

if (document.all)

window.external.AddFavorite(location.href, document.title);

else if (window.sidebar)

window.sidebar.addPanel(document.title, location.href, “”)

}

</script>
Body

<a href=”javascript:bookmarksite()”> Add to favorites </a>

Powered by WordPress | Shop Free T-Mobile Phones Online | Thanks to Verizon Phones without Contract, MMORPG Games and Sell Car