简体   繁体   English

将文本插入另一页上的文本区域

[英]Insert text into a textarea on a different page

Just wondering if anyone can help me. 只是想知道是否有人可以帮助我。 I'm building a refreshed version of a website and the old designer has put a feature on the website where when the user clicks on one of the icons it takes them to the contact page but also fills in the textarea on the contact form with the title of the link. 我正在构建一个网站的刷新版本,旧设计师在网站上放置了一个功能,当用户点击其中一个图标时,它会将它们带到联系页面,但也填写联系表单上的文本区域。链接的标题。

I was just wondering if anyone knew how to do this. 我只是想知道是否有人知道如何做到这一点。 This is not a duplicate question as I am asking how to do this across 2 pages. 这不是一个重复的问题,因为我要求如何跨2页进行此操作。

Thanks 谢谢

You can use in javascript 你可以在javascript中使用

function getURLParameter(name) {
  return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null
}

then get text like 然后得到像文本

var textfromURL= getURLParameter('content');

and set that "textfromURL" in your text box 并在文本框中设置“textfromURL”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM