jquery 纯html页面之间如何传递参数??


a页面的一段代码


 <li id="template">
    <a href="course/course_detail.html" data-ajax='false'>
        <img src="images/01.png" id="_img"/>
        <h3 id="Course_Name"></h3>
        <p>
            讲师:<span id="Teachername"></span>
            时长<span id="Credit_hour"></span>分钟
            时间:<span id="Course_CreateDate"></span>
        </p>
    </a>
</li>

b页面的一段代码


 <tr>
        <td class="table_1">课程名称:</td>
        <td colspan="3" class="table_2">心情美好</td>
      </tr>
      <tr>
        <td class="table_1">时长:</td>
        <td class="table_1">2</td>
        <td class="table_1">讲师:</td>
        <td class="table_2">专家团</td>
      </tr>

我想把a页面 li 里面每个 span 标签 id 获取到的值,传到b页面对应的 td 里,求指导。

jquery-mobile html5 移动web开发 HTML JavaScript

Sound 10 years, 1 month ago

来自 iteye 的文章: HTML5本地存储不完全指南

如果你的程序需要在不同页面访问同一个值,你可能需要了解这个值是否已经被其他页面改变了,这可以通过向浏览器注册storage事件来实现:


 window.addEventListener('storage', function(e) {
    console.log(e.key + "'s value is changed from '" +
        e.oldValue + "' to '" + e.newValue + "' by " + e.url);
}, false);

//A页面
localStorage['foo'] = 'bar';

//B页面
localStorage['foo'] = 'newBar';

这时你应该会在 A 页面的 Console 中看到:


 foo’s value is changed from ‘bar’ to ‘newbar’ by http://localhost/test.html

求女王包养 answered 10 years, 1 month ago

Your Answer