Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Obtaining all X,Y Co-ordinates of a page 2

Status
Not open for further replies.

ma701sd

IS-IT--Management
Dec 15, 2000
94
GB
Im trying to capture every X and Y Co-ordinate of a page.
Is there some kind of function of special tag that I culd learn so that when I run my mouse over any section of a page, an X and Y co-ordinate is given??

Any help would be greatly appreciated

Sam
 
Thanx, Could you give me an example of how I would put the clickable class inside the submit button please :)

Thanx
S....
 
<INPUT class=&quot;clickablearea&quot; TYPE = &quot;Submit&quot; VALUE =&quot;Enter&quot;>
<INPUT class=&quot;clickablearea&quot; TYPE = &quot;Reset&quot; VALUE =&quot;Clear&quot;>
jared@aauser.com
 
Hi Jaredn,
Thanks for helping, but that didnt seem to work, I did put the end tag tag i.e. </DIV> at the end of the submit you suggested above.

I also put in the ! at the end of src....
i.e.
if(eobj.srcElement.className!==&quot;clickablearea&quot;)

Any other ideas..your help is greatly appreciated

Cheers
Sam
 
!== is not !=

or i guess you could say:

(!==) != (!=)

if you get my point. adam@aauser.com
 
actually apparently i'm wrong. (!==) == (!=) in certain cases... yours being one of them. adam@aauser.com
 
Hi,

Thanx for all your previous help, I have one more Question (Which is hopefully my last :) ),

The code works well i.e. I can click anywhere on the page and 1 pair of co-ordinates are captured succesfusly.
Using these co-ordinates, I can display a variable on an action page (page 2) anywhere I want.

Is there a way of defining multiple areas as clickable

i.e. on page 1 I can select a clickable area and the values of X and Y are captured in 1 input box, and then capture another clickable area for a second input box on that same page so that on my action page (page 2) I can position two variables given by the TWO pair of XY cordinates captured on page 1?

I hope this makes sense?

Once again, Your help is greatly appreciated

AFter all the improvements you suggested, here is what the code look like:
<style>
.clickablearea{cursor:hand;}
</style>
</head>

<body>

<script>
function mouseMoved()
{


var eobj,thex,they
eobj = window.event
if(eobj.srcElement.className!=&quot;clickablearea&quot;)
{
thex = eobj.clientX
they = eobj.clientY
document.formname2.y.value=thex
document.formname2.x.value=they
}

}

document.onclick=mouseMoved
</script>


<form name=&quot;formname2&quot; ACTION =&quot;previewXYpage.cfm&quot; METHOD=&quot;Post&quot; >

<class=&quot;clickablearea&quot;>This line is clickable

The X Co-Ordinate is <input type=&quot;text&quot; name=x Value=0><BR>
The Y Co-Ordinate is <input type=&quot;text&quot; name=y Value=0>

<INPUT class=&quot;clickablearea&quot; TYPE = &quot;Submit&quot; VALUE =&quot;Enter&quot;>
<INPUT class=&quot;clickablearea&quot; TYPE = &quot;Reset&quot; VALUE =&quot;Clear&quot;>



</FORM>

</body>
</html>

(For some reason, I do not need the Div tags? and it works fine)

An urgent response will be greatly appreciated :)

Regards
Sam...
 
Hi Jaredn,
Thanx for the tip, but I dont have a foggiest of how to go about it? I am a complete complete novice when it comes to programming and especially Javascript.
Could you maybe provide an example?

Thanx
Sam
 
Dear ma701sa, I hate to sound offensive, but you should really try to read at least ONE book on JavaScript before flooding this list with such kind of questions. Imagine you go to Math group and start asking how to solve x^2+x+1=0 and then demanding explanations on why solution is two complex numbers ;). ---
---
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top