javascript学习指南_Javascript利用iframe框架实现文件上传

更新时间:2019-07-21    来源:js教程    手机版     字体:

【www.bbyears.com--js教程】

html

 代码如下


    姓名:

    年龄 :

    头像 :

   


js

 代码如下

<script>
$(document).ready(function()
{

//获取返回的document
function getDoc(frame) {
     var doc = null;

     // IE8 cascading access check
     try {
         if (frame.contentWindow) {
             doc = frame.contentWindow.document;
         }
     } catch(err) {
     }

     if (doc) { // successful getting content
         return doc;
     }

     try { // simply checking may throw in ie8 under ssl or mismatched protocol
         doc = frame.contentDocument ? frame.contentDocument : frame.document;
     } catch(err) {
         // last attempt
         doc = frame.document;
     }
     return doc;
 }

function postToIframe(formObj,callback){
    $("#multi-msg").html("");
    var formURL = formObj.attr("action");

    //生成随机id
    var  iframeId = "unique" + (new Date().getTime());

    //生成空白的iframe
    var iframe = $("

本文来源:http://www.bbyears.com/wangyezhizuo/59210.html

热门标签

更多>>

本类排行