//主机地址 var hostAddress = "http://localhost/CharDir/"; //var hostAddress = "Http://192.168.1.23:8080/"; var currentXMLUrl = ""; var currentExcelXslUrl = ""; var currentXslName = ""; var onoff = true; //111应付保费 按钮事件 $(document).ready(function() { $('#MPayPremium').click(function() { if (document.implementation && document.implementation.createDocument) { // // 支持Mozilla浏览器 try { xmlDoc = document.implementation.createDocument("", "", null); xmlDoc.async = false; xmlDoc.load(hostAddress + "MPayPremium/Index.xml" + "?time=" + getExcelFileName('a')); } catch (e) { alert("error:001"); } try { xslDoc = document.implementation.createDocument("", "", null); xslDoc.async = false; xslDoc.load("chartDir/MPayPremium/index.xsl"); } catch (e) { alert("error:002"); } try { // 定义XSLTProcessor对象 var xsltProcessor = new XSLTProcessor(); xsltProcessor.importStylesheet(xslDoc); var oResultFragment = xsltProcessor.transformToFragment(xmlDoc, document); // 将解析过的文本输出到页面 $('#rightside').html(oResultFragment); } catch (e) { alert("error:003"); } } else if (typeof window.ActiveXObject != 'undefined') { //IE浏览器 // Load XML var xml = new ActiveXObject("Microsoft.XMLDOM") xml.async = false xml.load(hostAddress + "MPayPremium/Index.xml" + "?time=" + getExcelFileName('a')) // Load XSL var xsl = new ActiveXObject("Microsoft.XMLDOM") xsl.async = false xsl.load("chartDir/MPayPremium/index.xsl") $('#rightside').html(xml.transformNode(xsl)); $('.divTitle').hover(function() { $(this).addClass('hover'); }, function() { $(this).removeClass('hover'); }); $('.divTitle').click(function() { //设置导出XML的地址 currentXMLUrl = this.title; //设置导出XML的XSL地址 currentExcelXslUrl = "chartDir/MPayPremium/MPayPremiumToExcel.xsl"; //设置导出文件的名字 currentXslName = this.innerText; CallMppTable(); }) } }); });