我已经构建了一个具有多个div的基本联系人,在没有CMS的本地主机上测试后它似乎工作,但是当我创建一个wordpress插件并通过短代码调用表单时,帖子没有显示任何迹象填充。
function pagechange(frompage, topage) {
var page=document.getElementById('formpage_'+frompage);
if (!page) return false;
page.style.visibility='hidden';
page.style.display='none';
page=document.getElementById('formpage_'+topage);
if (!page) return false;
page.style.display='block';
page.style.visibility='visible';
return true;
}

<form action="" method="post">
<div id="formpage_1" style="visibility: visible; display: block;">
<h1>We would Love to Hear about your Project!</h1>
<p>Please answer a few questions, this will save time on communication and help you receive an answer quickly.</p>
<?php if(isset($_POST['cf-submitted'])) {
$name = $_POST['name-form'];
echo $name;
} ?>
<input class="button1-form" type="button" value="next" onclick="pagechange(1,2);" />
</div>
<div id="formpage_2" style="visibility: hidden; display: none;">
<h4>What is your name?</h4>
<input type="text" name="name-form" />
<input class="next-btn-form" type="button" value="next" onclick="pagechange(2,3);" />
</div>
<div id="formpage_3" style="visibility: hidden; display: none;">
<h4>Hello! Tell us your Company Name?</h4><?php echo $name; ?>
<input type="text" name="companyname" />
<input class="next-btn-form" type="button" value="next" onclick="pagechange(3,4);" />
</div>
<div id="formpage_4" style="visibility: hidden; display: none;">
<h4>Tell us a bit about your Project?</h4>
<input type="text" name="project" />
<input class="next-btn-form" type="button" value="next" onclick="pagechange(4,5);" />
</div>
<div id="formpage_5" style="visibility: hidden; display: none;">
<h4>What is your email so we can contact you?</h4>
<input type="email" name="email" />
<input class="next-btn-form" type="submit" value="next" onclick="pagechange(5,1);" />
</div>
&#13;
我刚刚在jsfiddle上测试过它,现在似乎都没有工作,我在这里错过了一些东西吗? 我还在学习,所以我不是最好的XD
亚历