0

我正在尝试从 wordpress 页面中的 wufoo 表单在 javascript 代码中输入页面标题值。

我添加了以下代码:

'autoResize':true,
'height':'1092',
'async':true,
'host':'wufoo.com',
'header':'show',
'defaultValues':'field9=**boomboom**',
'ssl':true};

我需要将 替换为boomboom帖子页面标题,这样我就可以在每次表单登顶时捕获帖子的名称。

谢谢,曼努埃尔

4

1 回答 1

0

感谢你帮助丹,

<div id="wufoo-s121gtwf14azmyy">
Fill out my <a href="https://creativedoing.wufoo.com/forms/s121gtwf14azmyy">online form</a>.
</div>

<script type="text/javascript">
/* <![CDATA[ */
var postData = {"postTitle":"<?php echo get_the_title(); ?>"};
/* ]]> */
</script>

<script type="text/javascript">var s121gtwf14azmyy;(function(d, t) {
var s = d.createElement(t), options = {
'userName':'creativedoing',
'formHash':'s121gtwf14azmyy',
'autoResize':true,
'height':'1092',
'async':true,
'host':'wufoo.com',
'header':'show',
'defaultValues':'field1=**<?php echo get_the_title(); ?>**',
'ssl':true};

s.src = ('https:' == d.location.protocol ? 'https://' : 'http://') + 'www.wufoo.com/scripts/embed/form.js';
s.onload = s.onreadystatechange = function() {
var rs = this.readyState; if (rs) if (rs != 'complete') if (rs != 'loaded') return;
try { s121gtwf14azmyy = new WufooForm();s121gtwf14azmyy.initialize(options);s121gtwf14azmyy.display(); } catch (e) {}};
var scr = d.getElementsByTagName(t)[0], par = scr.parentNode; par.insertBefore(s, scr);
})(document, 'script');</script>
于 2016-04-19T04:20:31.163 回答