SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Mar 2004
    Location
    dahab
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy any one can help me please

    Hi all,

    any one can help me please

    I want to be able to select from large drop down menue using a link, this code is working great, but when I want to rename the name="category" to name="category[]" it stop working !!
    and I need this code to be work with name="category[]"

    <!-- Code start ************************* -->
    </HEAD>

    <script language=javascript>
    // format the keyboard display to display the values


    function initialize() {
    if (document.keyboard) {
    keyword1=document.keyboard.category.value;

    // update the keyboard display with the letters entered
    Line1.innerHTML=keyword1;

    }

    }

    // type the letters and build the letter string

    function type(char)
    {
    var char_string;
    var reverse_string;
    var option = new Object;
    var temp_var="";
    option = document.keyboard.category;


    if (char=='&lt;' || char=='<')
    {
    temp_var = option.value
    option.value = temp_var.substring(0,temp_var.length-1);

    initialize ();
    }
    else
    {
    temp_var=option.value
    option.value = temp_var + char;

    initialize ();
    }


    }



    </SCRIPT>




    <BODY aLink=#ffffff leftMargin=0 link=#000000 text=#000000 topMargin=0 vLink=#000000 bgcolor="#FFFFFF">



    <div align="center">

    <TABLE border=0 cellSpacing=0 bordercolor="#000080" bgcolor="#FFFFFF">
    <TR>
    <TD align="center">
    <a href="javascript:type('1#1#1')">cat 1</a>
    <a href="javascript:type('2#2#2')">cat 2</a>
    <a href="javascript:type('3#3#3')">cat 3</a>
    <a href="javascript:type('4#4#4')">cat 4</a>
    <a href="javascript:type('5#5#5')">cat 5</a>

    <br>

    <form name="keyboard">
    <select name="category" rows=10 cols=35 size="20" >
    <option value=1#1#1>Category1::subcategory::subsubcategory</option>
    <option value=3#12#77>Category1::subcategory::subsubcategory</option>
    <option value=5#25#191>Category1::subcategory::subsubcategory</option>
    <option value=5#25#192>Category1::subcategory::subsubcategory</option>
    <option value=1#1#1>Category1::subcategory::subsubcategory</option>
    <option value=2#2#2>Category2::subcategory::subsubcategory</option>
    <option value=5#25#191>Category2::subcategory::subsubcategory</option>
    <option value=5#25#192>Category2::subcategory::subsubcategory</option>
    <option value=1#1#1>Category2::subcategory::subsubcategory</option>
    <option value=3#12#77>Category2::subcategory::subsubcategory</option>
    <option value=3#3#3>Category3::subcategory::subsubcategory</option>
    <option value=5#25#192>Category3::subcategory::subsubcategory</option>
    <option value=1#1#1>Category3::subcategory::subsubcategory</option>
    <option value=3#12#77>Category3::subcategory::subsubcategory</option>
    <option value=5#25#191>Category3::subcategory::subsubcategory</option>
    <option value=5#25#192>Category3::subcategory::subsubcategory</option>
    <option value=1#1#1>Category3::subcategory::subsubcategory</option>
    <option value=3#12#77>Category3::subcategory::subsubcategory</option>
    <option value=5#25#191>Category3::subcategory::subsubcategory</option>
    <option value=4#4#4>Category4::subcategory::subsubcategory</option>
    <option value=1#1#1>Category4::subcategory::subsubcategory</option>
    <option value=3#12#77>Category4::subcategory::subsubcategory</option>
    <option value=5#25#191>Category4::subcategory::subsubcategory</option>
    <option value=5#25#192>Category4::subcategory::subsubcategory</option>
    <option value=1#1#1>Category4::subcategory::subsubcategory</option>
    <option value=3#12#77>Category4::subcategory::subsubcategory</option>
    <option value=5#5#5>Category5::subcategory::subsubcategory</option>
    <option value=5#25#192>Category5::subcategory::subsubcategory</option>
    <option value=1#1#1>Category5::subcategory::subsubcategory</option>
    <option value=3#12#77>Category5::subcategory::subsubcategory</option>
    <option value=5#25#191>Category5::subcategory::subsubcategory</option>
    <option value=5#25#192>Category5::subcategory::subsubcategory</option>
    <option value=1#1#1>Category5::subcategory::subsubcategory</option>
    <option value=3#12#77>Category5::subcategory::subsubcategory</option>
    <option value=5#25#191>Category5::subcategory::subsubcategory</option>
    <option value=5#25#192>Category5::subcategory::subsubcategory</option>
    </select>

    </TD>
    </TR>
    </TABLE>
    </div>


    <DIV dir=rtl id=Line1 style="POSITION: relative; TEXT-ALIGN: right; VISIBILITY: visible; WIDTH: 160px"></DIV>
    <!-- end ***************************** -->

  2. #2
    SitePoint Enthusiast geebee2's Avatar
    Join Date
    Mar 2004
    Location
    Gloucester UK
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ..but when I want to rename the name="category" to name="category[]" it stop working !!
    and I need this code to be work with name="category[]"

    ..
    <select name="category" rows=10 cols=35 size="20" >
    name="category[]" is not allowed.

    ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").
    http://www.w3.org/TR/html40/types.html#h-6.2

    Why do you want to do this? You don't need to!
    George

    http://qaaz.com

    For low cost database-driven web-sites

  3. #3
    SitePoint Wizard silver trophy
    Join Date
    May 2003
    Posts
    1,843
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why do you want to do this?
    PHP array, that's why.
    Code:
    keyword1=document.keyboard['category[]'].value;
    This is a little better supported (not much of an issue any more):
    Code:
    keyword1=document.keyboard['category[]'].options[document.keyboard['category[]'].selectedIndex].value;
    http://jibbering.com/faq/faq_notes/square_brackets.html
    ::: certified wild guess :::


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
  •