File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Security and the fly likes whenever i click on image Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Security
Bookmark "whenever i click on image" Watch "whenever i click on image" New topic

whenever i click on image

sudharani Savadi
Ranch Hand

Joined: Feb 23, 2011
Posts: 30

hi experts !

whenever i click on image it should be toggled to another image and also returns the x and y co-ordination values. simultaneously it should retrieve x,y pixel values and has to display the next image. I want to apply the same procedure for five images in a single JSP page. I tried with the below code i got only x and y values but image is not toggling.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script type="text/javascript">

var obj;

function point_it(event){

pos_x = event.offsetX?(event.offsetX):event.pageX-document.getElementById("pointer_div").offsetLeft;
pos_y = event.offsetY?(event.offsetY):event.pageY-document.getElementById("pointer_div").offsetTop;
document.pointform.form_x.value = pos_x;
document.pointform.form_y.value = pos_y;





<form name="pointform" method="post">

<div id="pointer_div" onclick="point_it(event)" style = "background-image:url('pic01.jpg');width:500px;height:333px;"></div>

You pointed on x = <input type="text" name="form_x" size="4" /> - y = <input type="text" name="form_y" size="4" /></div>


help me out.

I appreciate your help.
Tim Moores

Joined: Sep 21, 2011
Posts: 2417
What does this have to do with security (which this forum is all about) ?
sudharani Savadi
Ranch Hand

Joined: Feb 23, 2011
Posts: 30

I have not asked about the security. I am providing password authentication by using images, I mean to say instead of giving text I can use images to authenticate a user. I know its not possible with JSP that's why i want use JavaScript but I am not getting the correct output.
I agree. Here's the link:
subject: whenever i click on image
It's not a secret anymore!