BigNoseBird.Com- home Small Logo
The 508 Compliant Guide to 
       Big Nose Bird
BACK

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:

Map Area

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. source code

 <INPUT TYPE="TEXT" NAME="maparea" SIZE=2 VALUE="">
 <input type=button onClick='targetitem = document.forms[0].maparea; 
 dataitem = window.open("map.shtml",
 "dataitem", "toolbar=no,menubar=no,scrollbars=yes"); dataitem.targetitem = targetitem' 
 value="Show Map">
In this example, you will see that I have forms[0] 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[1]. You can have as many of these pop-ups as you want on a form, just change the document.forms[0].maparea to be document.forms[0].fieldname.
Here are the contents of the pop-up window:
<script>gt;
function select_item(item)
{
targetitem.value = item;
top.close();
return false;
}
</script>gt;

<CENTER>gt;
<B>gt;Our Map</B>gt;
<BR>gt;

<IMAGE SRC="map1.gif" ISMAP USEMAP="#MAP1">gt;
<MAP NAME="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;
</MAP>gt;
</CENTER>gt;
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.
    <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
 
Home Top E-Mail
If it looks great, it's by Christine
Some Fine Print
© 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 Privacy Statement. We can be contacted at webmaster@bignosebird.com.


<reallybig.com>
Web Builder Network Portal
Advertise
on the
Reallybig.com
Network
BigNoseBird Newsletter
Subscribe
Un-Subscribe


Sign up today to receive our low volume newsletter. Tips, tricks, news, and whatever else crosses our minds.
Back Issues
Privacy Statement