简体   繁体   English

自动填写表格-通过点击链接

[英]Auto Fill Form - From Pressed Link

I have this website: website link 我有这个网站: 网站链接

When the user clicks on one of the items in the gallery, I want the image to open (in a lightbox ?). 当用户单击图库中的项目之一时,我希望打开图像(在灯箱中?)。 Here I want to have a link to a prefilled contact form with the item in question. 在这里,我想链接到带有相关项目的预填写的联系表单。

someone provided me this code to get start but it only auto fills the form. 有人向我提供了此代码以开始使用,但它只会自动填写表格。 It doesn't forward to the contact form and auto fill it in. 它不会转发到联系表单并自动填写。

<form>
    <input type="text" id="packageDescription">
    <input type="text" id="packagePrice">
</form>

<script>

    function autoFill(packageDescription, packagePrice) {

        document.getElementById('packageDescription').value = packageDescription;
        document.getElementById('packagePrice').value = packagePrice;

    }

</script>

<a href="#" onClick="autoFill('Premium Package', 150); return false;">Premium Package</a><br>
<a href="#" onClick="autoFill('Platinum Package', 350); return false;">Platinum Package</a>

Thanks 谢谢

仅当链接本身和联系表在同一页面中找到时,提供给您的此代码才有效

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

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