|
|
|
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 | | | Enchancing dd/mm/yyyy forms with unobtrusive javascript Categories : Java Script, HTML, User Interface, Date Time | | | Fancy "Quick Access" Navigation Link Categories : Java Script, Navigation, User Interface, DHTML, Beginner Guides | | | javascript doesn't accept a fieldname with [] Categories : Java Script | | | Dynamic Calender in PHP, Javascript and HTML. Categories : PHP, Java Script, HTML and PHP, Calendar | | | Clock at Status Bar Categories : Java Script, HTML, Date Time | | | Javascript URL and Email Validation Categories : Java Script, Data Validation, Form Processing, Email, URLs | | | 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 | | | write an event to the eventlog via JScript Categories : Java Script, Windows 2000 | | | Pull Down Surfing - Surf on Change Categories : Java Script, MySQL, HTML and PHP, PHP, Databases | | | Java Script Based Navigation Categories : HTML, Java Script, Navigation | | | Hilight Form Element onFocus Categories : Java Script, Form Processing, CSS | | | Zephyr: AJAX Based Framework for PHP5 Developers Categories : PHP, AJAX, Frameworks, Java Script, Web Applications | | | AJAX XML HTTP Request - Compatible with almost browsers! Categories : AJAX, HTTP, Java Script | |
|
|
|