Show mouse position using javascript


Program to show Mouse Position using JavaScript.

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">

var IE = document.all?true:false
if(!IE)document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;

var tempX = 0
var tempY = 0

function getMouseXY(e)
{
    if (IE)
    {
        tempX = event.clientX + document.body.scrollLeft
        tempY = event.clientY + document.body.scrollTop
    }
    else
    { 
        tempX = e.pageX
        tempY = e.pageY
    } 

    document.Show.MouseX.value = tempX
    document.Show.MouseY.value = tempY

    return true
}
</script>    
</head>
<body>
<form name="Show">
      <input type="text" name="MouseX" value="0" size="4"> X<br>
      <input type="text" name="MouseY" value="0" size="4"> Y<br>
</form>
</body>
</html>


0 comments :

Add Favicon to site using Html



A Favicon is a graphic image associated with a particular Webpage and/or Website displayed by browser:
  • in the address box,
  • in the Favorites (Bookmarks) pane and menu,
  • modern browsers also display them in tabs,
  • and there is also an extension for Firefox, which displays favicons on Google search pages.
You can create a favicon in any icon editor. It should be 16×16 in size. Once you have the icon ready, rename it to favicon.ico and upload it to your Server root folder.


Assigning favicon to a page :- 

To activate your favicon, you must modify the source of your web page. Add this line to the <head> section of your page:

<link rel="shortcut icon" type="image/png" href="favicon.png" />
or
<link rel="shortcut icon" type="image/ico" href="favicon.ico" />

 Following example shows complete html of a very simple page with favicon:

<html>
<head>
<title>Title of my page</title>
<link rel="shortcut icon" type="image/png" href="favicon.png" />
</head>
<body>
Example to show use of Favicon.
</body>
</html>

Note: Simply changing the filename extension of an image to .ico without converting it to an ICO file will result in an error and not displaying the favicon.

0 comments :

Send data from html to jsp page



first.html

 <html>
<body>

<form action="second.jsp" method="post">

 Name :<input type="text" name="name">
 <input type="submit" value="SUBMIT">
</form>

</body>
</html>

User Input :- KK

****************************

Second.jsp

 <html>
<body>

Hi <%= request.getParameter("name") %>


</body>
</html>

Output:-

Hi KK

0 comments :