viktor
03-17-2003, 05:49 PM
The code pasted further down makes it possible to submit the coordinates for an imagemap (type 'poly') into an inputbox, by clicking at different areas of an image. The use for this btw would be in an ASP-form, so that admins can define where a country/city etc is located when it is added to a database.
QUESTION: Now I wonder if there is anyway of demonstrating WHICH PART of the image has been "mapped" (like it is in for example dreamweaver). I can only guess how it could be done:
- Imagefiltering but only for the area which is defined by the coordinates,?
- "Draw" colored lines between coordinates, on a layer on top of the image?
Please someone help, or let me know if this is completely impossible! I'm sure if it would work this could be useful for someone else as well. Thanks/Viktor
------
<html>
<head>
<script language="javascript">
function writeMap(writeWhere){
previousvalue=document.forms.myform[writeWhere].value
thisX = event.clientX
thisY = event.clientY
document.forms.myform[writeWhere].value=previousvalue+thisX+','+thisY+','
}
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<a href="#" onclick="writeMap('myfield')"><img src="myimage.gif" name="myimage.gif" width="174" height="160" border="0" usemap="#myimage.gifMap">
<map name="myimage.gifMap">
</map>
</A>
<form name="myform" method="post" action="">
<input type="text" name="myfield">
</form>
</body>
</html>
QUESTION: Now I wonder if there is anyway of demonstrating WHICH PART of the image has been "mapped" (like it is in for example dreamweaver). I can only guess how it could be done:
- Imagefiltering but only for the area which is defined by the coordinates,?
- "Draw" colored lines between coordinates, on a layer on top of the image?
Please someone help, or let me know if this is completely impossible! I'm sure if it would work this could be useful for someone else as well. Thanks/Viktor
------
<html>
<head>
<script language="javascript">
function writeMap(writeWhere){
previousvalue=document.forms.myform[writeWhere].value
thisX = event.clientX
thisY = event.clientY
document.forms.myform[writeWhere].value=previousvalue+thisX+','+thisY+','
}
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<a href="#" onclick="writeMap('myfield')"><img src="myimage.gif" name="myimage.gif" width="174" height="160" border="0" usemap="#myimage.gifMap">
<map name="myimage.gifMap">
</map>
</A>
<form name="myform" method="post" action="">
<input type="text" name="myfield">
</form>
</body>
</html>