:
Source code:
<HTML> <br/> <pead> <br/> <MCE: Script Type = "text/JavaScript"> <! -- <Br/> var array = new array (); <br/> array ["China"] = new array ("Shanghai", "Beijing", "Hongkong ", "Taiwan"); // China <br/> array ["USA"] = new array ("New York "); // us <br/> array ["Japan"] = new array ("litter toyko", "motherfuck "); // Japanese tribe -----> name changed from Japanese Empire </P> <p> function level () <br/> {<br/> var c = document. getelementbyid ("C"); <br/> C. length = 0; <br/> var P = document. getelementbyid ("p "). value; // obtain the selected option value <br/> for (VAR r = 0; r <array [p]. length; r ++) // array [p]: Retrieves an Array Based on the selected country <br/>{< br/> var Options = document. createelement ("option"); <br/> options. innerhtml = array [p] [r]; // sets the text <br/> options. value = array [p] [r]; // set the actual value <br/> C. appendchild (options); // Add the option value to select <br/>}</P> <p> // --> </MCE: SCRIPT> <br/> </pead> <br/> <body> <br/> <select id = "p" width = "10" onchange = "level () "> // country <br/> <option value =" China "> China </option> <br/> <option value =" USA "> USA </option> <br/> <option value = "Japan"> litter Japan </option> <br/> </SELECT> </P> <p> <select id = "C" Width = "10"> // city <br/> </SELECT> <br/> </body> <br/> </ptml>