Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/380.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在html中获取从一个页面到另一个页面的一篇文章的id_Javascript_Jquery_Local Storage - Fatal编程技术网

Javascript 在html中获取从一个页面到另一个页面的一篇文章的id

Javascript 在html中获取从一个页面到另一个页面的一篇文章的id,javascript,jquery,local-storage,Javascript,Jquery,Local Storage,我试图从一个页面到另一个页面获取一个对象的id 我有两页 index.html 简介.html index.html <input type="text" name="fname" value="" id="idnew"> <a href="intro.html"><input type="button" value="Post" id="butonid"></a> <script> $("#but

我试图从一个页面到另一个页面获取一个对象的id

我有两页

  • index.html
  • 简介.html
index.html

 <input type="text" name="fname" value="" id="idnew">
    <a href="intro.html"><input type="button" value="Post" id="butonid"></a>

    <script>
       $("#butonid").click(function(){
               $('#idnew').val("4")
    }
    </script>

$(“#butonid”)。单击(函数(){
$('#idnew').val(“4”)
}
现在我想将id idnew的输入值发送到intro.html页面

请帮助我,在加载intro.html之前,val(“4”)设置该元素的值,并与上一页一起丢弃。 要发送该值,您可以完全忘记javascript并使用以下表单:

<form action="intro.html" method="get">
    <input type="text" name="idnew" value="">
    <input type="submit" value="Submit">
</form>


然后,为了访问该值,例如在php中,使用$\u GET['idnew']

使用本地/会话存储来实现这一点,我感到困惑。您能澄清一下您的问题吗?听起来您只需要传递一个变量-这就是表单的用途。请参阅: