Results 1 to 6 of 6

Thread: My own HTML Object

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    142
    Is there a way I could program my own tailor-made selection list to be placed on an HTML page?

    Say I wanted to change the way the standard selection list looks/works, how would I go about doing so?

    thanks

    dvst8
    Secret to long life:
    Keep breathing as long as possible.

  2. #2
    Guest
    I'm sorry, what do you mean by "selection list?" Do you mean a list of hypertext links?

    If so, there's a couple of ways to do it. One, you can have your app generate a complete HTML formatted text file. Two, you can have the app dump the results to JavaScript formatted file which is included by a dynamic HTML page. Is this what you're looking for?

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    142
    No by selection list I mean something like:

    Code:
    <select name="teams" multiple size="3">
      <option>Toronto Maple Leafs</option>
      <option>Detroit Red Wings</option>
      <option>Boston Bruins</option>
    </select>
    I want to know how can I alter the properties (color, size, how it reacts to onclick events....) of this select list, or write my own?

    Thanks.
    dvst8
    Secret to long life:
    Keep breathing as long as possible.

  4. #4
    Guest
    I don't know that there is a way to change the look. As far as the reaction...you can use JavaScript as shown in the code below:



    <!-- this is the file hockey.htm -->

    <HTML>
    <HEAD>

    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function goThere(form) {
    var places=new Array()
    places[0] = "hockey.htm";
    places[1] = "http://www.torontomapleleafs.com";
    places[2] = "http://www.detroitredwings.com";
    places[3] = "http://www.bostonbruins.com";
    var i = form.redirector.selectedIndex;
    location.href = places[i];
    }

    function showSelected(form){
    var selectedItems = ""
    var message = "You selected: \n";
    var x = form.stuff.length;
    for (i=0;i<x;i++) {
    if (form.stuff.options[i].selected) {
    selectedItems += form.stuff.options[i].text;
    selectedItems += "\n";
    }
    }
    if (selectedItems=="") selectedItems = "Nothing";
    message += selectedItems;
    alert(message);
    }
    // -->
    </SCRIPT>
    </HEAD>

    <BODY>
    HI<p>

    <FORM>

    Choose a site to go to:<P>
    <SELECT NAME="redirector" onChange="goThere(this.form);this.form.redirector.selectedIndex=0;">
    <OPTION>Select a site
    <OPTION>Toronto
    <OPTION>Detroit
    <OPTION>Boston
    </SELECT>

    <P>

    <SELECT NAME="stuff" MULTIPLE SIZE=3>
    <OPTION>Montreal
    <OPTION>Detroit
    <OPTION>Boston
    </SELECT>
    &nbsp;
    <INPUT TYPE="button" VALUE="Go get it" onClick="showSelected(this.form);">
    </FORM>

    </BODY>
    </HTML>


    You could have your app generate the HTML page. Does this help?

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    142
    thanks for the reply jlopez.

    it helps, but not exactly for what I want to do.

    here's my situation:

    You know when you have a <select></select> list, it shows one item, and as soon as you click on that item, the rest of the list pops out? You select an item, and then it returns to the "show one item only" look. I like this..it's very compact and neat.

    But what I need is a <select multiple></select> list that will look and feel the same, except for the fact that it will allow for multiple selections. When you put that multiple attribute in the there, and force the size of the list to "1",you don't quite get the same thing. When you click on the list you only see one element at a time. And this is annoying.

    So what I would need, is for the list to pop out, and let the user to hold down CTRL, select as many as he wants and then return to the "show one item only" look....

    Understand?

    I really don't think it can be done, because the way these objects react to most standard events has been set in the HTML spec. If you know a way around, please let me know.

    My original idea is to write my own "<select>" list object, but I'm not sure if that can be done either...? How would the client's browser recognize it?

    Thanks for your help.

    dvst8

    [Edited by dvst8 on 08-10-2000 at 05:09 PM]
    Secret to long life:
    Keep breathing as long as possible.

  6. #6
    Guest
    if you know java, you can probably write a java applet that will do that for you...
    or you may be able to make a little flash movie thing that does that...

Posting Permissions

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



Click Here to Expand Forum to Full Width