Monday, January 11, 2010

JavaScript for getting user details

If you want to get user detail through java script, use this script


<!-- ONE STEP TO INSTALL IP ADDRESS:

1. Copy the coding into the HEAD of your HTML document -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
// http://www.kdcgrohl.com

// Depending on your server set-up,
// you may need to use the ".shtml"
// extension [instead of the "html"
// or "htm"] as the script uses Server
// Side Includes. To display in the
// title bar, exclude the
//"<title></title>" code from the page.

// This part gets the IP
var ip = '<!--#echo var="REMOTE_ADDR"-->';

// This part is for an alert box
alert("Your IP address is "+ip);

// This part is for the status bar
window.defaultStatus = "Your IP address is "+ip;

// This part is for the title bar
document.write("<title>Your IP address is "+ip+"</title>");
// End -->
</script>


<p><center>
<font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

<!-- Script Size: 1.09 KB -->

Thursday, January 7, 2010

Add to favorite link script

Some times we can see a add to favorite link in many sites. When you click on this link, the "Favorites" window pop-ups asking if you would like to add the site to the list.
Let us first see the advantages of adding such a link:
If visitors really like your site, they can easily add it to their favorites list through the normal process - Under Internet Explorer, click on the "Favorites" menu item and then on "Add to Favorites...".
However, they might just forget about this or they just might feel lazy (...you now what I mean). If you have an "Add To Favorites" link, you not only remind the visitors of the favorites folder but also prompt them to add your site and this just takes one click.
Here we use a little JavaScript and tie it up to the HREF tag of the link and here is the JavaScript function code:
function addfav()
{
if (document.all)
{
window.external.AddFavorite
("http://www.addictdotnet.blogspot.com","Dot the Net")
}
}
Note: The javascript statement "window.external.AddFavorite(..." should be a single line
The part in red color in the above code is the URL and the blue is the Name you want to give to the link.
The function can be placed inside the document head or an external .js file and will be called from the link as:
Add To Favorites