2
I have the following problem, I have a image map, where by clicking on the coordinates the result appears inside a <input type="text" />
, but I can only name one of the clicked coordinates.
I would like to know how to insert more than one coordinated name within it input
.
Follows the code:
<html>
<head>
<script type="text/javascript">
function local(name){
document.myform.post_localp.value = name
}
</script>
</head>
<body>
<form name="myform" action="" method="POST">
<input type="text" name="post_localp" size="20">
<div id="anterior" style="display:none" class="imgAnterior">
<img src="imagem.png" alt="anterior" usemap="#tutorials">
<map name="tutorials">
<area shape="rect" coords="142,284,185,308" href="#" alt="JE" onclick="local('J.E')">
<area shape="rect" coords="209,284,249,308" href="#" alt="JE" onclick="local('J.D')">
</map>
</div>
</body>
</html>
I appreciate the help Valdeir, could help me with some solution too?
– Joao Hauptmam
Change to
document.myform.post_localp.value += name
– Sam
dvd, worked out the way you said, the problem is that if you click more than once in the coordinate it repeats the result. Is there any way to prevent that from happening?
– Joao Hauptmam
Yes... But it is good to always put in the question everything you want, for example, "do not repeat etc"...
– Sam
I got it, it’s because I had no idea that this could happen, you would happen to know how to do it so that it doesn’t happen again?
– Joao Hauptmam