I have an application with a parent menu and a dependent child menu (actually several of them). Both are populated from a mySQL database (code not shown). Php directly writes the parent options in HTML when the page is first loaded (get_parent_menu). When the parent menu is changed, the onChange Javascript (update_child) updates the child menu. Works exactly as described, except I really want the child menu to be populated when the pages is loaded, and not wait until the parent menu is changed. Is there a way to have update_child run when the page is first loaded? Ideally, I wouldn’t use a onload located outside of the parent select html which wouldn’t allow “this” and prevent the code from being modular. Thanks
<SELECT name=”menu_1″ id=”menu_1″ onChange=”update_child( this.options[ this.selectedIndex ] );”>
<?php
include_once ‘functions.php’;
echo get_parent_menu(“SQL_menu_1”);
?>
</SELECT>
<SELECT name=”menu_1_children” id=”menu_1_children”></SELECT>