Thursday, September 24, 2009

FUN WITH JAVASCRIPT



Lets have some fun with javascript

type in browser URL

javascript:document.bgColor=”red”;

// hurray the screen will flicr with red color for sometime

To make the background red just add void(0); after code like

javascript:document.bgColor=”red”;void(0);

just enjoy



How to check string in javascript


Its very easy use

parseInt or isNaN

example

alert(isNaN(11)); // this will return false or

alert(parseInt(”this is string”)); // this will return NaN means not a number




How to hack cookies


I am telling some things only for knowlegde .Dont use it for malicious purpose

To get the cookie jus try the step.

1) Open www.google.com

2) In url just type this from begining

javascript:alert(document.cookie);

press enter

3) Heyyyyyy You will get the cookies .

Same way you can do it with different sites


get Browser name


Its very simple

This will give the name of the browser . so simple..

If you want in detail operating system also use

navigator.userAgent()




how can we send mail through javascript


Here we can send email by using “mailto” function in javascript

here is the script to do the task

function sendEmail(formName)
{
var inputMessage=document.formName.msgbox.value;
location=”mailto:emailaddress@domainname.com?subject=hi&message=”+inputMessage;
return true;
}




How to autoscroll div vertically


// inside this we are having long message

this will led the message go out of the div. In order to fix the message inside the div we must have another

div



// long message

Here fix the width and make overflow auto in style attribute of the div.





0 comments:

Post a Comment