[英]How to get the attribute value from parent page.I tried using opener and window.parent.But doesn't work
I am working on javascript and jquery. 我正在研究javascript和jquery。 In page1 there is an edit symbol (which have "news" and "image" as attributes like,
news="news1" image="image1.jpg"
). 在第1页中有一个编辑符号(其中包含“news”和“image”作为属性,如
news="news1" image="image1.jpg"
)。
When click on that symbol it takes us to the other page (in href i mentioned the page url).Now in this page2 i want to get those attributes. 当点击该符号时,它将我们带到另一页(在href我提到了页面网址)。现在在这个页面2我想获得这些属性。 I tried as follows but doesn't work
我尝试如下但不起作用
How can i get those values..? 我怎样才能获得这些价值......? I put that code in
onload
and document.ready
我将该代码放在
onload
和document.ready
Consider sending values "news1" and "image1.jpg" to page2 as URL arguments: 考虑将值“news1”和“image1.jpg”作为URL参数发送到page2:
<page2 URL>?news=news1&image=image2
Edited: 编辑:
Can you place your data into hidden inputs inside a form, and use your link to submit it ( onclick="form.submit();"
)? 您可以将数据放入表单中的隐藏输入,并使用您的链接提交它(
onclick="form.submit();"
)?
This way you'll make a POST request instead of GET. 这样你就可以发出POST请求而不是GET。
I think you can put the two attributes as parameters in the 'href' of the 'a' in page1; 我想你可以把这两个属性作为参数放在page1中'a'的'href'中; like:
喜欢:
href="xxx.com/xxx/?news=new1&image=image1"
; href="xxx.com/xxx/?news=new1&image=image1"
;
and in page2 you can get the two parameters in the URL and then use it; 在第2页中,您可以在URL中获取两个参数,然后使用它;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.