donglu5000 2013-03-02 07:48
浏览 7
已采纳

javascript无所事事

i am trying to make a finish time in a line of text update depending on the length of time selected in the drop down box relative to the start time.

so if the start time was 13:00 and the user selects 1 hour the finish time would update to 14:00

I dont have a clue what i am doing right or wrong since i dont know the first thing about javascript.

  <script type='text/javascript'>
         function changeText(){
            var option=document.getElementById('time').value;
               if(option=='30'){
                     document.getElementById('field').value='".date(strtotime("$finishtime + 30 minutes"))."';
                               }

              else if(option=='60'){
                     document.getElementById('field').value='".date(strtotime("$finishtime + 60 minutes"))."';
                               }
             }
  </script>

i dont seem to be getting any errors in the debugger and the script does nothing.

<a>Booking For ".$start." - </a><a id='field'>".$finishtime."</a><a> on ".$date."</a>

         <form enctype='multipart/form-data' method='post'>
                 <a class='1'>Session Length</a>
                       <select name='time' id='time' onchange='changeText();'>
                             <option selected='selected'></option>
                             <option id='30' value='30'>30 mins</option>
                             <option id='60' value='60'>1 Hour</option>
                       </select>
  • 写回答

1条回答 默认 最新

  • douzhi1919 2013-03-02 07:54
    关注

    use

    document.getElementById('field').text
    

    instead of

     document.getElementById('field').value
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 MATLAB中streamslice问题
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序