显示旧图像而不是新图像。(在javascript中刷新) [英] Old Image shown instead of new image.(refresh in javascript)

查看:82
本文介绍了显示旧图像而不是新图像。(在javascript中刷新)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

function ViewIns_onclick(tempObj) {
		    var temp = tempObj.parentNode.parentNode.parentNode.rows.length - 1;
		    t_id = tempObj.parentNode.parentNode.rowIndex - 1;		 
		    var filePath = "";
		   
		    if (temp == 1) {		        
		        if (document.forms[0].Hdn_Global_Ins_file.value == "" || document.forms[0].Ins_File.value != "") {
		            filePath = document.forms[0].Ins_File.value;
		            alert('You cannot view image or document before uploading.')
		            return false;
		        }
		        else { filePath = document.forms[0].Hdn_Global_Ins_file.value;   }
		        
		        if (filePath.length <= 0) {
		            alert('Select File to view.');
		            if (document.forms[0].AUTH_STATE.value == "" || document.forms[0].AUTH_STATE.value == "01" || document.forms[0].AUTH_STATE.value == "02") {
		                document.forms[0].Ins_File.focus();
		            }
		            return false;
		        }
		        else {	          
		            
		            var spos = filePath.lastIndexOf(".");
		            var ftype = filePath.substr(spos + 1, (filePath.length - spos));
		            ftype = ftype.toLowerCase();
		            if (ftype == 'doc' || ftype == 'docx' || ftype == 'jpg' || ftype == 'bmp' || ftype == 'gif' || ftype == 'tiff' || ftype == 'jpeg' || ftype == 'pdf') {
		                if (ftype == 'doc' || ftype == 'docx' || ftype == 'pdf') {
	                   		 window.open(filePath, 'View_Ins', 'height=400,width=400,toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,modal=yes');
		                }
		                else {
		                    window.open(filePath, 'View_Ins', 'toolbar=no,scrollbars=yes,menubar=no,height=300,width=300');
		                }		               
		            }
		            else {
		                alert('Invalid File Format.');
		                if (document.forms[0].AUTH_STATE.value == "" || document.forms[0].AUTH_STATE.value == "01" || document.forms[0].AUTH_STATE.value == "02") {
		                    document.forms[0].Ins_File.focus();
		                }
		                return false;
		            }
		        }
		    }
		    else if (temp > 1) {		   
		    if (document.forms[0].Hdn_Global_Ins_file[t_id].value == "" || document.forms[0].Ins_File[t_id].value != "") {
		            filePath = document.forms[0].Ins_File[t_id].value;
		            alert('You cannot view image or document before uploading.')
		            return false;
		        }
		        else { filePath = document.forms[0].Hdn_Global_Ins_file[t_id].value;  }
                	
		        if (filePath.length <= 0) {
		            alert('Select File to view.');
		            if (document.forms[0].AUTH_STATE.value == "" || document.forms[0].AUTH_STATE.value == "01" || document.forms[0].AUTH_STATE.value == "02") {
		                document.forms[0].Ins_File[t_id].focus();
		            }
		            return false;
		        }
		        else {                		           
		            var spos = filePath.lastIndexOf(".");
		            var ftype = filePath.substr(spos + 1, (filePath.length - spos));
		            ftype = ftype.toLowerCase();
		            if (ftype == 'doc' || ftype == 'docx' || ftype == 'jpg' || ftype == 'bmp' || ftype == 'gif' || ftype == 'tiff' || ftype == 'jpeg' || ftype == 'pdf') {

		                if (ftype == 'doc' || ftype == 'docx' || ftype == 'pdf') {
		                    window.open(filePath, 'View_Ins', 'height=400,width=400,toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,modal=yes');
		                }
		                else {
		                    window.open(filePath, 'View_Ins', 'toolbar=no,scrollbars=yes,menubar=no,height=300,width=300');
		                }		                
		            }
		            else {
		                alert('Invalid File Format.');
		                if (document.forms[0].AUTH_STATE.value == "" || document.forms[0].AUTH_STATE.value == "01" || document.forms[0].AUTH_STATE.value == "02") {
		                    document.forms[0].Ins_File[t_id].focus();
		                }
		                return false;
		            }
   	               }
		    }
		}

推荐答案

hi


你可以连接时间跨度查询字符串和filePath变量。



Ex。



var dNow = new Date();

filePath = document.forms [0] .Ins_File.value +?ts =+ dNow.getHours ()+ dNow.getMinutes()+ dNow.getSeconds();
hi
you can concatenate time span Query string with filePath variable.

Ex.

var dNow = new Date();
filePath = document.forms[0].Ins_File.value+ "?ts="+ dNow.getHours()+ dNow.getMinutes()+ dNow.getSeconds();


这篇关于显示旧图像而不是新图像。(在javascript中刷新)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆