dongzhuo5185 2012-03-23 13:24
浏览 47
已采纳

通过输入和图像按钮提交搜索表单?

I'm customizing Wordpress's Twenty Eleven 'SearchForm' / 'searchform.php' --

I want to keep the Enter-to-Search functionality; but I want to add my custom Image button for users to also have the traditional click-button-submit.

HOWEVER; when I drag the Ids, classes, and name used on the functional default to the new Image button - my image does not display. But, when I don't have those classes, etc used.. It renders?

Below is where I'm currently at with the code. (Any suggestions?)

<?php
/**
 * The template for displaying search forms in Twenty Eleven
 *
 * @package WordPress
 * @subpackage Twenty_Eleven
 * @since Twenty Eleven 1.0
 */
?>

<form method="get" id="searchform" name="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<label for="s" class="assistive-text"><?php _e( 'Search', 'twentyeleven' ); ?></label>
<input type="text" class="field" name="s" id="s" value="Search, title, author, keyword" onfocus="ClearForm();" style="width: 225px;">
<input type="submit" src="http://#/wp-content/uploads/2012/03/searchnav_btn.gif" style="position:absolute;" value="<?php esc_attr_e( 'Search' ); ?>" class="submit" name="submit" id="searchsubmit"/>

<input type="image" src="#/wp-content/uploads/2012/03/searchnav_btn.gif" style="position:absolute;" value="<?php esc_attr_e( 'Search' ); ?>" class="submit" name="submit" id="searchsubmit"/>

</form>

<script language="javascript">
<!--
function ClearForm() {
  document.searchform.submit.value= "";
}

//-->
</script>
  • 写回答

1条回答 默认 最新

  • dongya4089 2012-03-23 14:40
    关注

    You can try adding a z-index to the image styling to see if it will appear on top.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器