js里面怎么多排添加字符?

来源:4-1 数据渲染

qq_庄周梦蝶_1

2017-04-24 11:46

var heml = '<div class="ui-datepicker-header">
                <a href="#" class="ui-datepicker-btn ui-datepicker-prev-btn">&lt;</a>
                <a href="#" class="ui-datepicker-btn ui-datepicker-next-btn">&gt;</a>
                <span class="ui-datepicker-curr-month">2017-4</span>
            </div>
            <div class="ui-datepicker-body">
                <table>
                    <thead>
                        <tr>
                            <th>一</th>
                            <th>二</th>
                            <th>三</th>
                            <th>四</th>
                            <th>五</th>
                            <th>六</th>
                            <th>七</th>
                        </tr>    
                    </thead>                    
                    <tbody>                        
                        <tr>                            
                            <td>29</td>
                            <td>30</td>
                            <td>1</td>
                            <td>2</td>
                            <td>3</td>
                            <td>4</td>
                            <td>5</td>
                        </tr>
                        <tr>                            
                            <td>6</td>
                            <td>7</td>
                            <td>8</td>
                            <td>9</td>
                            <td>10</td>
                            <td>11</td>
                            <td>12</td>
                        </tr>
                        <tr>                            
                            <td>13</td>
                            <td>14</td>
                            <td>15</td>
                            <td>16</td>
                            <td>17</td>
                            <td>18</td>
                            <td>19</td>
                        </tr>
                        <tr>                            
                            <td>20</td>
                            <td>21</td>
                            <td>22</td>
                            <td>23</td>
                            <td>24</td>
                            <td>25</td>
                            <td>26</td>
                        </tr>
                        <tr>                            
                            <td>27</td>
                            <td>28</td>
                            <td>29</td>
                            <td>30</td>
                            <td>1</td>
                            <td>2</td>
                            <td>3</td>
                        </tr>                        
                    </tbody>
                </table>
            </div>';


写回答 关注

1回答

  • 沉迷前端无法自拔
    2017-04-24 16:11:03
    已采纳

    每个标签左右俩边加'这个符号,然后例如'<td>1</td>' + '<td>1</td>'这样,视频里面都有讲的

DatePicker组件开发

使用原生JS完成一个日期选择器(datepicker)组件的开发

17743 学习 · 64 问题

查看课程

相似问题