通过网络地址,向另一个页面传数据

  通过网络地址,向另一个页面传数据;

  <a href=06.html?id=2>将数据传另一个页面</a>

  这种方法类似于利用Ajax通过get方式的传参;

  var sd=location.href  通过这种方式,便能得到url的网络地址

  var sp=sd.split("=");  字符串中方法,split()  通过"=" 进行分割;

  console.log(sp);  查看值,便能看到通过id传的值;

原文地址:https://www.cnblogs.com/shangjun6/p/10775452.html