WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Select a value for your form from a list in a separate window.
Categories : User Interface, Java Script Update Picture
Edwin Boersma
Date : Jan 20th 2003
Grade : 2 of 5 (graded 4 times)
Viewed : 3762
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Edwin Boersma
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

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