现在的位置: 首页 > 综合 > 正文

静态html页面传值

2018年04月14日 ⁄ 综合 ⁄ 共 268字 ⁄ 字号 评论关闭

例如从1.html跳转到2.html:

在1.html中:

  <form name="loginForm" action="2.htm?pageid=1&str='s'" method="post">

当页面提交跳转到2.html中:

<script type="text/javascript">
  <!--
   var str = location.search;
  //-->
   </script>

通过location对象的search属性得到的字符串为:?pageid=1&str='s'

在2.html中通过indexOf就可以搜索到你需要使用的值

抱歉!评论已关闭.