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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic Positioning

Status
Not open for further replies.

ma701sd

IS-IT--Management
Dec 15, 2000
94
GB
Hi,
Can anyone suggest a way of displaying an X and Y co-ordinate of an image.
What I want to do is to offer an image and as a user runs the mousepointer over that image, each point is displayed as an X and Y co-ordinate.
Based on this co-ordinate, I can then pass this on as variables to an action page to poistion text or images related the the X and Y co-ordinate that the user chose?


I can do the latter part i.e. assuming I have the X and Y co-ordinate, I can position anywhere on the action page:

The code snippet for ths is as follows:

(Assuming that I have the desired and Y co-ordinate of the page)
<FORM ACTION= &quot;previewXYpage.cfm&quot; METHOD=&quot;POST&quot;>

Enter your X Co-ordinate <INPUT TYPE =&quot;Text&quot; NAME=&quot;X&quot;><BR>
Enter your Y Co-ordinate <INPUT TYPE =&quot;Text&quot; NAME=&quot;Y&quot;><BR>
<INPUT TYPE = &quot;Submit&quot; VALUE =&quot;Enter&quot;>
<INPUT TYPE = &quot;Reset&quot; VALUE =&quot;Clear&quot;>

Displaying &quot;whatever&quot; based upon the X and Y co-ordinate defined by the previous input page:

<STYLE TYPE=&quot;text/css&quot;>
#companyname
{
position:absolute;
top: <CFOUTPUT>#X#</cfoutput>px;
left: <cfoutput>#Y#</cfoutput>px;
}
</style>

</head>
<body>
<DIV ID=&quot;CompanyName&quot;>
&quot;The stuff that I want to be positioned according the co-ordinates specified&quot;
</div>
</body>
</html>

Any ideas or suggestions would be greatly appreciated :)

Thanks in advance

Sam
 
Hey Sam,

If you can use a form to submit to the next page, just make the image an <input type=&quot;image&quot;..> and the browser will automatically pass the x and y coordinates for you.

Try this,

<input type=&quot;image&quot; src=&quot;image1.jpg&quot; name=&quot;img1&quot; border=&quot;0&quot;>

and in the receiving script, just reference the coordinates as #img1.x# and #img1.y#.

Let me know if this works.
GJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top