The function exists of three parts. First, you need a form in an HTML-page. The form needs a name for this to work! In the form, put the following HTML:
<a href="ListMyOptions.html"
target=wInfo
onclick="window.open('','wInfo','width=300,height=300,scrollbars=1');"
<img src=questionmark.gif>
</a>
The file ListMyOptions.html contains some HTML to make a list of your options. This could also be
PHP, that gets the data from some database. For each option, add the following HTML:
<a href=javascript:CopyValue('<FieldName>','<Value>','<FormName>')>Option description</a>
where:
- <FieldName> is the name of the filed in your form
- <Value> is what you want to put in this field
- <FormName> is the name of the form
The JavaScript you need is this:
function CopyValue(ChangeWhat,ValueToCopy,aForm) {
changer = "window.opener.document." + aForm + "." + ChangeWhat + ".value='" + ValueToCopy + "'";
eval(changer);
window.close();
}
A click on the option in the list will now put the desired value in the box and close the help
window. If you also want to submit the form directly, add these lines:
submitme = "window.opener.document." + aForm + ".submit()";
eval(submitme);
Building dynamic menus with PHP & MySQL (ADO), JavaScript and CSS Categories : PHP , Databases , MySQL , Java Script , User Interface Fancy Quick Access Navigation Link Categories : Java Script , Navigation , User Interface , DHTML , Beginner Guides Enchancing dd/mm/yyyy forms with unobtrusive javascript Categories : Java Script , HTML , User Interface , Date Time Table editable dynamic form with edit + selection (select / option) + checkbox.
Categories : Java Script , DHTML , User Interface , CSS , HTML Java Script which implements a Clock (Client Side) Categories : Java Script , Date Time ezRemoteScripter - A little remote scripting (AJAX) helper Categories : PHP , Java Script , AJAX Validating a URL with JavaScript RegExp Categories : Java Script , Data Validation , Beginner Guides Javascript Color Picker Categories : Java Script , Colors , HTML Simple Javascript CSS Digital Clock Categories : Java Script , Date Time , CSS , Beginner Guides , Web Design Unobtrusive javascript for maintaining scrollable layer state Categories : DHTML , Java Script , HTML Cool tool tip Categories : Java Script , HTML , Web Design Java Script Based Navigation Categories : HTML , Java Script , Navigation Builds JavaScript that updates the contents of one selector based on another. Categories : HTML , Java Script , PHP , Complete Programs , General Flash Detection Script with loads of features Categories : Java Script , Flash Show or Hide your Content using Javascript Categories : Java Script , HTML , CSS , Beginner Guides