I want to be able to imitate a Windows pop up window, so the person completing
a form can click on a map to get the value. How do I get the value into the form?
There are two parts to this example. The first is the source code for your form
and the second is the HTML code that makes up our map lookup page.
Here is our form:
Try clicking on the "Show Map" button to see what happens. Then click on the number you
want and see what happens to the form's input field.
In this example, you will see that I have forms set. In fact there is a form
used for the navigation bar at the top of the page, so in the actual source code it
is set to forms.
You can have as many of these pop-ups as you want on a form, just change the
document.forms.maparea to be document.forms.fieldname.
<INPUT TYPE="TEXT" NAME="maparea" SIZE=2 VALUE="">
<input type=button onClick='targetitem = document.forms.maparea;
dataitem = window.open("map.shtml",
"dataitem", "toolbar=no,menubar=no,scrollbars=yes"); dataitem.targetitem = targetitem'
Here are the contents of the pop-up window:
You do not have to use an image map. You can also use regular text links to have this
script return a value to a form.
targetitem.value = item;
<IMAGE SRC="map1.gif" ISMAP USEMAP="#MAP1">gt;
<AREA SHAPE=RECT COORDS="11,10,116,133" HREF="" onClick='return select_item("1")'>gt;
<AREA SHAPE=RECT COORDS="121,11,227,172" HREF="" onClick='return select_item("2")'>gt;
<AREA SHAPE=RECT COORDS="11,140,115,226" HREF="" onClick='return select_item("3")'>gt;
<AREA SHAPE=RECT COORDS="119,177,225,227" HREF="" onClick='return select_item("4")'>gt;
<AREA SHAPE=default HREF="" >gt;
<a href="" onClick='return select_item("1")'>Area 1</a>
<a href="" onClick='return select_item("2")'>Area 2</a>
Find or Give Help on the BBS
If it looks great, it's by
© 1997-2003 BigNoseBird.Com®, Inc. All rights reserved.
All other trademarks are the sole property of their respective owners.
The products that we recommend are only ones that we use. We have no
relationship with any of the authors or their companies. We cannot
assume responsibility for their ultimate performance or lack of same.
We also cannot assume responsibility for either any programs provided
here, or for any advice that is given since we have no control over
what happens after our code or words leave this site. Always
use prudent judgment in implementing any program- and always make a
backup first! For further information, please read our
Some Fine Print
. We can be contacted
at Privacy Statement firstname.lastname@example.org.