Home >Web Front-end >HTML Tutorial >How to pass the object array of one page to another page, without background, save js_html/css_WEB-ITnose
I have two pages, no background, just implemented in HTML. For example, I have two pages
1.html and 2.html.
There is a temp array in 1.html, which stores image objects. There is a submit button in 1.html. Clicking the submit button will open the 2.html page and pass the temp array to 2.html.
How to achieve it? ? ?
Is the temp array a variable? Control the content inside through 1.html? And pass it to 2.html?
1.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title></head><body><p id="demo"><img src="http://c.csdn.net/bbs/t/5/i/pic_logo.gif" /><img src="http://images.csdn.net/20120528/程序员6月封面_副本_副本.jpg" /></p><button onclick="window.open('2.html');">OPEN</button><script type="text/javascript">var obj = document.getElementById('demo').getElementsByTagName('img'), ar = [];for (var i = 0; i < obj.length; i ++) ar.push(obj[i]);</script></body></html>
2.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title></head><body><script type="text/javascript">var ar = window.opener.ar;alert(ar[0].src);</script></body></html>
var ar = window.opener.ar
Please explain