View Full Version : Enabling and Disabling functions
GateKeeper
08-29-2002, 01:04 PM
I recently had an idea regarding an image map of a world I am using in a RolePlaying forum. In one instance, the image map is a series of clickable links that lead to other pages. What I wanted to do, however was write a script that would allow the visitor to click on the image at one point, move the mouse and then click again and use a formula to measure the distance between the two points. Now, I don't see that particular script as being too much of a problem, at least not at this point. However, what I would like to be able to do is allow the visitor to click on a button or radio check box to enable or disable this feature. My question is whether or not such a thing would be possible as it would also mean disabling the image map coding in some manner. If anyone has any thoughts on this, I am all ears.
GK
GateKeeper
08-29-2002, 01:31 PM
Another idea just occured to me.
How difficult would it be to draw a dot on the image each time the visitor clicks using the afore mentioned script and then connect those dots with a line of some sort, in effect drawing a course of travel on the image?
joh6nn
08-29-2002, 06:32 PM
it's doable, but it would be kind of a hard, i think. the bit with the checkbox, wouldn't turn off the image map. the bit about drawing the lines, that's pretty much impossible.
this is a pretty good article on finding mouse positon:
http://evolt.org/article/Mission_Impossible_mouse_position/17/23335/index.html
boywonder
08-29-2002, 11:02 PM
Originally posted by GateKeeper
My question is whether or not such a thing would be possible as it would also mean disabling the image map coding in some manner. If anyone has any thoughts on this, I am all ears.
It woulb be easy enough to call a function that performs it's action based on the checkbox:
<script language="JavaScript" type="text/javascript">
<!--
function doSomething(){
if(document.frm.ckbx.checked)alert("run code for checked");
else alert("run code for unchecked");
}
//-->
</script>
<form name="frm">
<input type="checkbox" name="ckbx">
</form>
in the href's for the image map put:
href="javascript:doSomething();"
Note you'll need to pass the URL to the function if one of the actions will be to link somewhere else.
hope that helps
Vladdy
08-29-2002, 11:13 PM
Everything you described, except the line part should not be that difficult, especially if you do not require support of older browsers. If you provide the link to what you have now (image with the map), I can look at it and tell you what is involved in accoplishing the task....
GateKeeper
08-30-2002, 03:43 PM
I may have worked a way around the line part by placing images based on the clicks. As far as enabling and disabling the various functions, I took a closer look at what I am trying to do and have decided to make the "trip planner" a seperate web page, thus eliminating the need for trying to control which functions are working at any given time. I will spend some time writing it up and try to get it up somewhere so a few of you can look at it and tell me whether or not there is a better way to do it. In any event, thanks for the input, it has definately helped.
GK
duniyadnd
08-30-2002, 04:26 PM
This might interest you
http://www.smokinggun.com/demos/line_draw.php# (http://www.smokinggun.com/demos/line_draw.php#)
Duniyadnd
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.