我之前发现过这个问题,通常答案建议在表单标签中插入#MyAnchor,作为动作字符串中的最后一个...但在这种情况下,动作字符串非常复杂,我应该在哪里放置锚点,以便页面重新加载到字段所在的相同位置(而不是在页面顶部)?
<div class="submit-form">
<?php if (get_option('cap_api_key') != ""){?>
<?php
//newsletter signup
if ($_SESSION['email_signup'] == "true"){
echo "Cadastro efetuado. Confira seu email."; $_SESSION['email_signup'] = "";
}elseif ($_SESSION['email_signup'] == "bad email"){
echo "Por favor coloque um endereço de email válido."; ?>
<form method="post" action="<?php bloginfo( 'template_directory' ); ?>/includes/mailchimp.php?api_key=<?php echo get_option('cap_api_key'); ?>&list_id=<?php echo get_option('cap_list_id'); ?>">
<fieldset>
<label for="lb01">Participe do CSVB</label>
<div class="inp02"><input value="Email Address" id="lb01" name="email" type="text" /></div>
<input type="submit" class="btn-submit" value="submit" />
</fieldset>
</form><?php
}else{?>
<form method="post" action="<?php bloginfo( 'template_directory' ); ?>/includes/mailchimp.php?api_key=<?php echo get_option('cap_api_key'); ?>&list_id=<?php echo get_option('cap_list_id'); ?>">
<a id="anchor" name="anchor"></a><fieldset>
<label for="lb01">Participe do CSVB</label>
<div class="inp02"><input value="Cadastre seu Email" id="lb01" name="email" type="text" /></div>
<input type="submit" class="btn-submit" value="submit" />
</fieldset>
</form>
<?php }} ?>
</div><!--submit-form-->
答案 0 :(得分:0)
您可以添加id="field"
,如果网址为#field