Results 1 to 2 of 2

Thread: Help with a <select> script

  1. #1
    Join Date
    Aug 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help with a <select> script

    I'm trying to get a script to work where when a person selects an option from a dropdown <select> list more options appear. At present it doesn't even look like the browser is listening for the event. You can see it live at: http://ccms.cteens.org/admin/dev/admin.php?id=addevent

    Here is the code:

    the html
    Code:
    <select name="the_repeat"  onchange="showrepeat(window.document.add_event.the_repeat.selectIndex.value);">
        <option value="0">No Repeat/Daily</option>
        <option value="2">Weekly</option>
        <option value="3">Monthly</option>
    </select>
    the js
    Code:
    function showrepeat(i) {
    		var a = 'weekly_repeat';
    		var b = 'monthly_repeat';
    	if (document.getElementById) {
    		var abra = document.getElementById(a).style;
    		var kadabra = document.getElementById(b).style;			
    		if (i == 0) {
    			abra.display = "none";
    			kadabra.display = "none";
    		} else if (i == 1) {
    			abra.display = "block";
    			kadabra.display = "none";
    		} else if (i == 2) {
    			abra.display = "none";
    			kadabra.display = "block";
    		}
    		return true;
    	} else {
    		return true;
    	}
    }
    Thanks for your help.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •