SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    Pragmatic Programmer halfasleeps's Avatar
    Join Date
    Feb 2006
    Location
    Altoona, PA. USA
    Posts
    1,945
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    why can't I get the options value?

    I am tryng this:

    HTML Code:
    <script>
    function changePerPage () {
    	var perPage = document.forms.pageForm.per_page.options[document.forms.pageForm.per_page.selectedIndex].value;
    	alert('d'+perPage);
    }
    changePerPage();
    </script>
    my form name and id is pageForm
    the select inside that form is name and id are both per_page

    so why can't I get the selected value????

    THANKS.
    Altoona Design
    Freelance Flex developer for hire.
    ActionScript Programmer with 8 Years Experience.

  2. #2
    Pragmatic Programmer halfasleeps's Avatar
    Join Date
    Feb 2006
    Location
    Altoona, PA. USA
    Posts
    1,945
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i also tried
    document.pageForm.per_page.options[document.pageForm.per_page.selectedIndex].value

    each time I get a error saying document.pageForm.per_page OR document.forms.pageForm.per_page is null or not an object
    Altoona Design
    Freelance Flex developer for hire.
    ActionScript Programmer with 8 Years Experience.

  3. #3
    Pragmatic Programmer halfasleeps's Avatar
    Join Date
    Feb 2006
    Location
    Altoona, PA. USA
    Posts
    1,945
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok it took me 3 hours to figure out I had to put the javascript after the form not before it.

    now it works.
    Altoona Design
    Freelance Flex developer for hire.
    ActionScript Programmer with 8 Years Experience.


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
  •