Archive for the 'javascript' Category

Fun with javascript

July 4, 2008

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

July 4, 2008

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

July 3, 2008

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

July 3, 2008

Its very simple
<script language =”javascript” >
alert(navigator.appName);
</script >
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

April 21, 2008

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

April 9, 2008

<div id=”mainbody”>
// inside this we are having long message
</div>
this will led the message go out of the div. In order to fix the message inside the div we must have another
div
<div id =”mainbody” style=”border:1px solid red;height:200px;width:200px;overflow:auto;”>
<div id=”msg”>
// long message
</div>
</div>
Here fix the width and make overflow auto in style attribute of the div.