Results 1 to 3 of 3

Thread: Need help with Javascript

  1. #1
    Join Date
    Jun 2010

    Need help with Javascript


    I am struggling with this and wonder if somebody could give me some advice:

    - I have a LinkedList<E> from my backing bean to feed data to a dropdown. Each element E has a value and a hint text. I want to display values to the dropdown and hint texts to an input Text next to the dropdown.

    I try to improve the performance by doing everything from the client side. I try to cache the list to an array then loop through that array to display values and hint text. But I have a hard time to make it work. Anyone has done something similar before or has experience with it, please let me know. I very appreciate your help.

  2. #2
    Join Date
    Jul 2007
    Here is an example:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <script type="text/javascript">
    function init()
        var opts = document.getElementById('ex').getElementsByTagName('option');
        for (var i = 0; l = opts.length, i < l; i++)
            opts[i].onmouseover = function(){
                document.getElementById('hint').innerHTML = this.title;
    <body onload="init();">
    <select name="ex" id="ex">
        <option value="0" title=""></option>
        <option value="1" title="Hint of example 1">Example 1</option>
        <option value="2" title="Hint of example 2">Example 2</option>
        <option value="3" title="Hint of example 3">Example 3</option>
        <option value="4" title="Hint of example 4">Example 4</option>
        <option value="5" title="Hint of example 5">Example 5</option>
    <span id="hint"></span>

  3. #3
    Join Date
    Jun 2010
    THank you very much!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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