Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/79.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.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 如何访问<;div id=";例如&燃气轮机;另一个html页面的名称?_Javascript_Html - Fatal编程技术网

Javascript 如何访问<;div id=";例如&燃气轮机;另一个html页面的名称?

Javascript 如何访问<;div id=";例如&燃气轮机;另一个html页面的名称?,javascript,html,Javascript,Html,URL是相同的,但路径不同,我想看看如何访问上一个html页面的示例id内容。想法 在JS中,您可以使用本地存储 HTML: 您可以使用localStorage您需要阅读SO关于如何发布问题的常见问题解答。iFrame或storage会有帮助吗?URL相同,但路径不同?这是不可能的,因为路径是URL的一部分。在jQuery中,使用div对该页面进行Ajax调用。假设其内容位于html变量中,则可以执行$('#示例',html).html()或$('#示例',html).text()。 <d

URL是相同的,但路径不同,我想看看如何访问上一个html页面的示例id内容。想法

在JS中,您可以使用本地存储

HTML:


您可以使用
localStorage
您需要阅读SO关于如何发布问题的常见问题解答。iFrame或storage会有帮助吗?URL相同,但路径不同?这是不可能的,因为路径是URL的一部分。在jQuery中,使用div对该页面进行Ajax调用。假设其内容位于
html
变量中,则可以执行
$('#示例',html).html()
$('#示例',html).text()。
<div id="example> </div>
//assign the value of the id
localStorage.setItem('value', example);

//get and assign the value 
var value= localStorage.getItem("value");