Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function update_select_options(target, opts_array) {
- if ($(target).type.match('select')) { // Make sure we are dealing with a select field
- var obj = $(target);
- // If any options are already in the select box, clear them
- // before creating the new options.
- if (obj.length > 0) {
- while (obj.hasChildNodes()) {
- obj.removeChild(obj.firstChild);
- }
- }
- // Loop through each option in the array, adding them to the
- // select field.
- for (var i = 0; i < opts_array.length; i++) {
- var o = document.createElement('option');
- o.appendChild(document.createTextNode(opts_array[i][0]));
- o.setAttribute('value', opts_array[i][1]);
- $(target).appendChild(o);
- }
- }
- }
- function update_submit_box(self) {
- var o = document.getElementById('school_submit');
- var loc = self.options[self.selectedIndex].text;
- if (loc) {
- o.value = 'I am currently a student at ' + loc;
- o.style.display = 'block'
- } else {
- o.style.display = 'none'
- }
- }
Add Comment
Please, Sign In to add comment