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

interactive online meter read submission

Status
Not open for further replies.

laura99

Programmer
Dec 9, 2005
11
0
0
CA
Hello,
i am trying to add a clickable meter read dial to a website
that once the mouse inside the clock like cirle (meter read dial) is clicked, the arm will move and a text box will reflect what the number is... here's an example .. for seeing the diale please click the check box for natural gas and the bottom of the page the dial will show up

thanks for your time in advance
 
fantastic. post the code you're having trouble with and we'll help you debug it. we are not a write-my-project-for-me-for-free sweatshop ;-)

-jeff
try { succeed(); } catch(E) { tryAgain(); } finally { rtfm(); }
i like your sleeves...they're real big
 
Thanks for reminding that to me Jemminger :), i guess what i need is direction as what approach to take, i can get the position of mouse on IE but not firefox or netscape as the first step...
this is what i have sofar
function OnclickIENS(form)
{
//this detects the objects defined withing IE4+
if(document.all)
{
document.MeterTest.DialeNumberx.value=event.offsetX;
document.MeterTest.DialeNumbery.value=event.offsetY;
}

//if (navigator.appName.indexOf("Netscape")!=-1)
//detects object supports for FireFox and NS6+
if(document.getElementById && !document.all)
{
document.MeterTest.DialeNumberx.value=event.pageX;
document.MeterTest.DialeNumbery.value=event.pageY;
}

once i get this to work, should i be looking at the cirle as
a 360 degree object and do the calculation...
 
Yes - to determine what angle the dial should be at, you can use basic trigonometry. You know the coordinates of the center of the dial, and you can make a triangle between that, the mouse coordinates, and the 90 degree angles to work out the angle you're at.

Remember that JavaScript works in radians, so you'll have to convert your measurement to degrees.

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top