0

我想添加这个功能

function list(){
    var html=" "
    for(var i =0; i<movements.length;i++){
    html+=("<p>" + movements[i][0]+ " " + movements[i][1] + " " + movements[i][2] + "</p>")}
    document.getElementById("listSpace").innerHTML = html;
}

单击可折叠并显示返回list()到文本块中:

<div data-role="collapsible-set" id="myCollapsible">
              <div data-role="collapsible" data-collapsed="true" >
                  <h3>
                      10 Last movements
                  </h3>
                  <div data-controltype="textblock">
                      <p>
                          <b id="listSpace">
                              10 last movements
                          </b>
                      </p>
                  </div>
              </div>
     </div>
4

1 回答 1

0

对您的代码进行了一些更改

function list() {
    var html = " ", movements = [['10', 'next', 'movements'],['10', 'next', 'movements'],['10', 'next', 'movements']];
    for (var i = 0; i < movements.length; i++) {
        html += ("<p>" + movements[i][0] + " " + movements[i][1] + " " + movements[i][2] + "</p>")
    }
    document.getElementById("listSpace").innerHTML = html;
}
$(document).ready(function () {
    $('div[data-role="collapsible"]').click(list);
});

看看小提琴

于 2013-11-01T08:05:49.507 回答