zoukankan      html  css  js  c++  java
  • html 用图片代替重置按钮

    提交时,若把按钮设置成图片提交特别方便只要 <input type="image" alt="点此提交" src="images/button.png" width=40 height=50>即可,但是重置能不能是图片样子呢?

    <input type="image" src="reset.gif" onclick="javascript:document.forms['testForm_2'].reset(); returnfalse;">

    大家别再试这种javascript的方式了没有用的,无论怎么return false点击图片进行重试后,依旧是会执行提交操作,

    我用设置css样式解决了 jsp代码如下


    <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>




    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        
        
        <title>My JSP 'tagnot.jsp' starting page</title>
        
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
        <style type="text/css">
    #bimg 
    {
    background:url(images/buttonreset.jpg) -60px -40px; 
    125px;
    height:30px;
    border:none;
    font-weight:bold;
    color:black;
    }
    </style>
      </head>
      
      <body>
          <form method="GET" action="">
            <input type="text" name="mae" value="wca">
            <input id="bimg" type="reset" value="重置" >
            </form>
      </body>
    </html>

    效果如图


    亲测好使,再也不会提交了,有木有,别的按钮也可以这样

  • 相关阅读:
    em与rem之间的区别以及移动设备中的rem适配方案
    关于两个DIV之间的空白字符
    Bootstrap基本模板
    js 裁剪
    记一次诡异的bug
    Node切换版本
    git 撤销
    使用 iframe + postMessage 实现跨域通信
    <el-input>标签限制输入小数点
    vue elementyUI table :点击一行时选中这一行对应的复选框
  • 原文地址:https://www.cnblogs.com/unflynaomi/p/4476858.html
Copyright © 2011-2022 走看看