#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    6
    Rep Power
    0

    HTML Active Dropdown List


    Hi,

    i want to make a dropdown list. The selected option must write on a differerent area of page.

    For example:

    Code:
    <select id="DayOfWeek" name="DayOfWeek">
        <option value="1">Sunday</option>
        <option value="2">Monday</option>
        <option value="3">Tuesday</option>
        <option value="4">Wednesday</option>
        <option value="5">Thursday</option>
        <option value="6">Friday</option>
        <option value="7">Saturday</option>
    </select>
    If user selects "Monday", "Monday" must be in a sentence.

    For example:

    Today is Monday and sunny day.

    If possible, the user can copy the all sentence. Because i will create a code and user wants to copy the code.

    Can anyone help?
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Location
    Burb of Detroit, Michigan
    Posts
    91
    Rep Power
    78
    Couldn't you do something like this?

    Code:
    <select id="DayOfWeek" name="DayOfWeek">
        <option value="Sunday">Sunday</option>
        <option value="Monday">Monday</option>
        <option value="Tuesday">Tuesday</option>
        <option value="Wednesday">Wednesday</option>
        <option value="Thursday">Thursday</option>
        <option value="FRIDAY">Friday</option>
        <option value="SATURDAY">Saturday</option>
    </select>
    However, If I am understanding you correctly you want to interject some code into it. I'll use php as a rough example, I'm sure you can do it with JavaScript.

    PHP Code:
    <select id="DayOfWeek" name="DayOfWeek">
    <? php 
    for ($count=1$count <= $page_count$count++) {
                echo 
    "<option value=\"{$count}\"";
                if (
    $calendar['day_of_the_week'] == $db_usr_table['count']) { echo " selected"; }
                echo 
    ">{$count}</option>";
            } 
    ?>
    </select>
    Obviously the code won't work and is somewhat logically impaired, but you could do something like that? Another option would to play around with date formats where it automatically picks the day.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    6
    Rep Power
    0
    Thank you Strider64,

    I got my solution with JavaScript few hours ago.

    Thanks again.

IMN logo majestic logo threadwatch logo seochat tools logo