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>

    效果如图


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

  • 相关阅读:
    asp.net后台注册js的四种方法
    前端代码标准最佳实践:CSS
    开始ASP.NET MVC5之旅
    Android应用中如何保护JAVA代码
    C# Winform 拦截关闭按钮触发的事件
    idea没有转换web选项
    Mysql Too many connections
    SpringBoot添加WEB模块
    Maven报错Failed to collect dependencies at com.***:***:jar:1.0.0
    CentOS出现内存溢出
  • 原文地址:https://www.cnblogs.com/unflynaomi/p/4476858.html
Copyright © 2011-2022 走看看