zoukankan      html  css  js  c++  java
  • form中的action,submit="return save()"以及ajax提交方法

    <form enctype="multipart/form-data" method="post" name="formform1" id="formform1"action="" onsubmit="">
    <table border="1" cellspacing="0" align="center" bgcolor="#EAEAEA" bordercolor="#EFEFEF" bordercolordark="#ffffff" style="font-size:12px;margin-top: 2px" width=1000px>
    <tr height="30px">
    <td align="center">
    <h5 style="1000px;height:20px;text-align:center;margin-top:30px;margin-bottom:25px;">项目区位图上传</h5>
    项目图类型:<select name="pictype" id="pictype" style="margin-top:20px;">
    <option value="" selected>请选择</option>
    <option value="1">域项目图</option>
    <option value="2">区域项目图</option>
    </select>&nbsp;<input type="file" id="xfile" name="xfile"style="450px;margin-top:20px;" onchange="CheckExt(this)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" name="UploadButton" id="UploadButton" value="上传" onclick="save()"><br>
    </td>
    </tr>
    <tr height="20px"rowspan="1"></tr>
    <tr rowspan="3">
    <td align="center">
    <table border="1" cellspacing="0" align="center" bgcolor="#EAEAEA" bordercolor="#EFEFEF" bordercolordark="#ffffff" style="font-size:12px;margin-top: 2px" width="1000">
    <tr algin="center">
    <td align="center">类别</td>
    <td align="center">操作</td>
    </tr>
    <list picturelist as list>
    <tr>
    <td>
    ${list.TITLE}<input type="hidden" value="${list.SPID}" name="ProjectPic" id="y">
    </td>
    <td>
    <a href="#" onclick="SeePic('${list.PATH}')"><font color="blue">预览</font></a>&nbsp;<a href="#" onclick="deleteProjectPic(${list.SPID})"><font color="blue">删除</font></a>
    </td>
    </tr>
    </list>

    </table>
    </td>
    </tr>

    </table>
    </form>

    2.js

    <script>
      function deleteProjectPic(spid){
    if(confirm("是否删除该信息?")) //弹出确认对话框
    {
    deletePic(spid);//点击确定时执行删除操作。
    }
    }
    function deletePic(spid){
    var timeOut = 1000*60*5;//5分钟
    jQuery.ajax({
    mode:"",
    async:false,
    url:"/Business/NewHouse/DeleteProjectPicAjax.5i5j",
    contentType:"application/x-www-form-urlencoded;charset=UTF-8",
    data:{SPID:spid},
    type:"post",
    timeout:timeOut,
    success:function(data){
    var code="";
    var message="";
    var xmldoc=jQuery.parseXML(data);
    jQuery(xmldoc).find("result").each(function(i)
    {
    code = jQuery(this).children("code").text();
    message = jQuery(this).children("message").text();
    });
    alert(message);
    window.location.href="/Business/NewHouse/NewHouseProjectCheckListView.5i5j";
    },
    error:function(XMLHttpRequest,textStatus,errorThrown){
    if(textStatus == "timeout"){
    alert("连接超时");
    }
    if(typeof ( loading)!="undefined"){
    loading.hide();
    }
    }

    });
    }

    </script>
  • 相关阅读:
    ubuntu
    什么是守护进程?
    Redis 简介
    什么是原子性,什么是原子性操作?
    什么是BSD协议?
    查看内存
    数据库备份与还原
    PostgreSQL 判断字符串包含的几种方法
    SQL 基础
    手风琴-过渡效果,显示隐藏列表案例
  • 原文地址:https://www.cnblogs.com/mayay/p/6919694.html
Copyright © 2011-2022 走看看