www.webdeveloper.com
Results 1 to 8 of 8

Thread: Whats wring with this code?

  1. #1
    Join Date
    Nov 2010
    Posts
    3

    Whats wring with this code?

    I want the inserted text to be under the droplist not on top of it!

    <html>
    <body>

    <script type="text/javascript">
    function showSelected(val)
    {
    document.getElementById('selectedResult').innerHTML="<a href='mailto:" + val + "'>" + val + "</a><p><font size=3></font>&nbsp;</p>"
    }
    </script>

    <div id='selectedResult'></div>
    <!-- This sets up the drop down list of names -->
    <select name='test' onChange='showSelected(this.value)' ID=Select1>
    <option value='user.1@email.net'>First User</option>
    <option value='user.2@email.net'>Second User</option>
    </select>

    </body>
    </html>

  2. #2
    Join Date
    Jan 2003
    Location
    Texas
    Posts
    10,413
    Code:
    <select name="test" onchange="showSelected(this.options[this.options.selectedIndex].value)" id="Select1">
    Visit Slightly Remarkable to see my portfolio, resumé, and consulting rates.

  3. #3
    Join Date
    Nov 2010
    Posts
    3
    that code makes no difference!

  4. #4
    Join Date
    Jan 2003
    Location
    Texas
    Posts
    10,413
    Put the "selectedResult" div beneath the select element in your HTML code. This isn't a JavaScript question.
    Visit Slightly Remarkable to see my portfolio, resumé, and consulting rates.

  5. #5
    Join Date
    Sep 2009
    Posts
    6
    is this serious? move the div below the select box!

  6. #6
    Join Date
    Nov 2010
    Posts
    3
    Sorry for asking a dumb question in, what turned out to be the wrong forum.

    I am learning this stuff and I thought it was the java code that was the problem.

  7. #7
    Join Date
    Jan 2003
    Location
    Texas
    Posts
    10,413
    No problem. Glad you figured it out.
    Visit Slightly Remarkable to see my portfolio, resumé, and consulting rates.

  8. #8
    Join Date
    Sep 2009
    Posts
    6
    Quote Originally Posted by DanielHowden View Post
    Sorry for asking a dumb question in, what turned out to be the wrong forum.

    I am learning this stuff and I thought it was the java code that was the problem.
    Glad you got it working and you may think i'm being a sponge for pointing this out - but java and javascript are two completely different things!

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



Recent Articles