Click to See Complete Forum and Search --> : Pop Up Message


DaveSim
02-10-2003, 02:22 PM
Hi all

I am new to Java, I use VBA as a rule.

Could someone please tell me how to program so that on a web page I could insert a code into a box and then a popup menu of some kind would show the part this refers to.

ie

I have five codes 1234, 1235, 1236, 1237, & 1238.

If I input code 1234 I want the program to show Desk, 1235 is Chair, 1236 is Table, etc. Maximum would be around 50 codes.

Thanks in advance for any help

Dave

Charles
02-10-2003, 02:34 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<title>Form Example</title>
<form action="someScript.pl" onsubmit="if (codes[this.code.value]) {this.item.value = codes[this.code.value]} else {alert('not assigned'); this.code.value = ''; this.code.focus();} return false">
<script type="text/javascript">
<!--
var codes = {'1234':'Desk', '1235':'Chair', '1236':'Table'};
// -->
</script>
<div>
<p><label for="code">Code:</label><br>
<input name="code" type="text"></p>
<p><label for="item">Item:</label><br>
<input name="item" type="text"></p>
<input type="submit">
</div>
</form>

Keep in mind that this will not work without JavaScript, about 10% of the time. You will need a server side version for back up.

DaveSim
02-11-2003, 06:58 AM
Hi Charles

Thanks very much for your help on this and especially your speedy reply

Regards

Dave