HTML嵌入三维仿真 .ezo文件的方法
2013-11-10 21:15
344 查看
近期做了一个信息管理系统的项目,其余CMS的东西都是比较Easy的,但是碰到了用户需要把外边团队制作的三维仿真的文件导入到HTML页面的问题。说实话EON的东西网上确实比较少,所以在问题解决后特把问题解决的方法跟大家分享一下。
注:本方法只支持IE
首先在要实现在IE下正常播放电脑需要安装一个EONViewer 下载地址:http://pan.baidu.com/s/1ADnDf#dir/path=%2FShare%2Feoz
在需要嵌入.eoz文件的地方引入
引入的两个js文件以及一个vb文件如下:
1.eonx_variables.js
2.eon_functions.js
注:本方法只支持IE
首先在要实现在IE下正常播放电脑需要安装一个EONViewer 下载地址:http://pan.baidu.com/s/1ADnDf#dir/path=%2FShare%2Feoz
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title> Eon with Web page</title> <meta name="description" content="Interactive EON 3D Application based on EON Studio, EON FastView, EON Raptor or EON Immersive"> <meta name="keywords" content="EonX, eonx, studio, raptor, fastview, immersive, 3D, EONWebPublisherEONX, AAD68411-5B98-11D3-9B52-00001C0007B3"> <meta Name="Expires" Content="Now"> <script LANGUAGE="JavaScript" TYPE="text/javascript" SRC="<?= base_url() ?>eoz/eonx_variables.js"></script> <script LANGUAGE="JavaScript" TYPE="text/javascript" SRC="<?= base_url() ?>eoz/eon_functions.js"></script> <script LANGUAGE="VBScript" TYPE="text/vbscript" SRC="<?= base_url() ?>eoz/eon_functions.vbs"></script> </head>
在需要嵌入.eoz文件的地方引入
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"> eonxSimulationFile = "<?= base_url() ?><?= $exp->route ?>" ; EONInsert(); </script>
引入的两个js文件以及一个vb文件如下:
1.eonx_variables.js
// --------------- EONX VARIABLES --------------- // We recommend that you use one eonx_variable.js file for all your EON applications // on your website. Then you will only have one place to update to the latest version. // This script contains all variables used by EonX and EONInsert(). Some variables // might be changed in your specific sim script, while some should not be changed. // Template Last modified Feb 1st, 2003. // Enter your default EONX Settings below: // Basic EonX properties var eonxHeight = 550; var eonxWidth = 750; var eonxAutoPlay = 1; var eonxProgressbar = 1; var eonxBackground = "#000000,"; // Obsolete variables, are not used anymore. var eonxToolbar = 0; var eonxSettingsButton = 0; // Note that this variable MUST be changed on the script on your local page!!! var eonxSimulationFile = "webexample1.edz"; // EON Server settings var eonxPrototypebaseURL = ""; var eonxTrackerURL = ""; // EON Configuration settings. For example: to force the use of OpenGL rendering. var eonxConfigurationScheme = ""; //"OpenGLRendering"; var eonxSchemeValues = ""; //"Render.EnableGL=1,Render.Dithering=1,Render.AdvancedQuality=1,Render.QualityLevel=3,Render.RenderQuality=1161,Render.TextureQuality=5"; // Use empty values since EonX automatically forces OpenGL now. Of course you may use other values, // but remember these values are forced, and settings like stereo will NOT work if not included here!!! // ----- WHEN EONX IS NOT INSTALLED ----- var LatestEONVersion = "5,1,1,926"; // This is the required version of EON Runtime var eonxClassid = "CLSID:AAD68411-5B98-11D3-9B52-00001C0007B3"; var eonxCreateObject = "Eon.EonX.2"; // Choose what should happen when EonX is not installed or old version installed. // For info on methods (0 - 13) contact: support @ eonreality.com var CheckAndHandleEonXStatus = 0; // recommend 1 // Choose a different method for Netscape var CheckAndHandleEonXStatusNN = 0; // recommend 1 // DocumentCodebase is calculated to return the absolute path of this document. Do not alter this! var DocumentCodebase= document.location.href.substring(0,document.location.href.lastIndexOf("/")+1); // EonX codebase and plugin page depend on if local or Internet distribution var LocalDistribution = false; var LatestEONDirectory; var eonxfileIE; var eonxfileNN; var eonxPluginsPage; if (LocalDistribution) // CD distribution { LatestEONDirectory = DocumentCodebase + "http://download.eonreality.com/eonx/5_1_1/"; //"redist/"; eonxfileIE = "eonx.cab"; // "eonx_loc.cab"; eonxfileNN = "eonx2.jar"; // "eonx2loc.jar"; eonxPluginsPage = DocumentCodebase + "plugin/eonx_plugin_page.html"; } else // Internet distribution { LatestEONDirectory = "http://download.eonreality.com/eonx/5_1_0/"; eonxfileIE = "eonx.cab"; //"eonx.cab"; eonxfileNN = "eonx2.jar"; //"eonx2.jar"; eonxPluginsPage = "http://download.eonreality.com/eonx/5_1_0/" + "eonx_plugin_page.html"; } var eonxCodebaseIE = LatestEONDirectory + eonxfileIE + "#Version=" + LatestEONVersion; // Do not alter var eonxCodebaseNN = LatestEONDirectory + eonxfileNN + "#Version=" + LatestEONVersion; // Do not alter // --- FINDING DLLs, SIMULATIONS and BACKGROUND IMAGES--- // Simulations files and Background image files (.bmp) should be relative to the // document or any of the codebases in eonxCodebase2. eg "../sim/chair5.eoz" is OK. var DLLsCodebase = LatestEONDirectory; var OtherCodebases = ""; var eonxCodebase2 = DocumentCodebase + ";" + DLLsCodebase + ";" + OtherCodebases; // Do not alter // --- WEBEON TOOL --- // The WEBEON Tool allows developers to see information about the running EON Application when // they press "555" (IE only). The file, WEBEON_Tool.html must exist in the same directory // as the web page containing the EON Application and this variable must be set to true. var EnableWEBEON_Tool = false;
2.eon_functions.js
// ---------------- EON_FUNCTIONS.JS ---------------- // eon_functions.js is an external javascript file used to // produce one set of commands that work in both browsers. // Last modified Apr 16th, 2004 // 10 ------------ CONTENTS ------------ // 30 GET PLATFORM AND BROWSER VERSIONS // 70 CHECKING IF EONX IS INSTALLED // 260 HANDLE EONX STATUS // 400 INSERT EON OBJECT // 500 EONX METHODS (Start, Stop, Pause, ShowSettingsDialog, FullSize, SaveSnapshot) // 580 OLD EONX PROPERTIES (Toolbar, ProgressBar, SettingsButton, AutoPlay) // (SimulationFile, Background, Codebase, Height, Width) // 775 NEW EONX PROPERTIES (Version, PrototypebaseURL, SchemeValues, ConfigurationScheme) // 825 SENDING and RECIEVING EVENTS // 975 METHODS FOR GETTING IN/OUT EVENT INFORMATION // 1065 WEBEON TOOL related code // 1125 BACKWARD COMPATIBILITY CODE // 1135 END // --- GET PLATFORM AND BROWSER VERSIONS --- // The following code detects the users platform, browser and browser versions // convert all characters to lowercase to simplify testing var agt = navigator.userAgent.toLowerCase(); var is_major = parseInt(navigator.appVersion); var is_minor = parseFloat(navigator.appVersion); // --- PLATFORM --- var is_win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1)); var is_win98 = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1)); var is_winnt = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1)); var is_win32 = (is_win95 || is_winnt || is_win98 || ((is_major >= 4) && (navigator.platform == "Win32")) || (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1)); // --- BROWSER & VERSION --- // Netscape var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible')==-1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)); var NN = is_nav; var is_nav4up=((is_nav)&&(is_major>=4)); var is_nav4_51up=(is_nav4up && (is_minor>=4.51)); var is_nav6=(is_nav && (is_major==5)); var is_nav6up=(is_nav && (is_major>=5)); var is_nav6_2up=false; var posStart=agt.indexOf('netscape6/')+10; if (posStart > 0) is_nav6_2up=(agt.substring(posStart,posStart + 3)>='6.2'); // Internet Explorer var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera")==-1)); var is_ie4up = (is_ie && (is_major >= 4)); // --- CHECKING IF EONX IS INSTALLED --- // The variable EonXStatus will be set by CheckEonXStatus() to one of: // -1 => Computer platform or browser is not supported // 0 => EonX is not installed // 1 => EonX is installed but lower version than required // 2 => EonX is installed with equal or higher version than required. var EonXStatus = -2; // means not checked yet. var InstalledVersion = "nothing"; // until proven otherwise if (NN) navigator.plugins.refresh(true);// in case plugin just installed and refreshing page. function CheckEonXStatus() { EonXStatus=-1; if ( (!is_win32) || ((!is_ie) && (!is_nav)) || ((!is_nav4_51up) && (!is_ie4up)) ) return; EonXStatus= 0; if (NN) // Check EonX status for Netscape { // Problem: In Netscape there's currently no way to check when Eon Runtime has been // UNinstalled and the Netscape plugin is still in the plugins folder. var eonPlugin = navigator.plugins["EonX Plug-In"]; if ( ((is_nav6up)&&((typeof eonPlugin)!="undefined")) || ((is_nav4_51up)&&(eonPlugin)) ) { EonXStatus = 1; // plugin exists since eonPlugin exists, assume old version. InstalledVersion="unknown"; var userVersion=eonPlugin.description.substring(26) // extract from 26th characater onwards. if (userVersion=="") userVersion="3,0,1,75"; else InstalledVersion=userVersion; if (VersionOK(userVersion, ",")) EonXStatus=2; } return; } else // Check EonXStatus for IE. { if (location.href.indexOf('?eonxstatus=')!=-1) { if (location.href.indexOf('?eonxstatus=1')!=-1) { EonXStatus=1; InstalledVersion = location.href.substring(location.href.indexOf('eonxver=')+8); } else EonXStatus=0; } else { EonXStatus=2; InstalledVersion = LatestEONVersion; // this is later changed by getting the body attribute called "eonxversioninstalled" } } } function VersionOK(VersionToCheck, SplitCharacter) { var strVersionToCheck = String (VersionToCheck); var a = strVersionToCheck.split(SplitCharacter); // a = EON version installed on users computer var b = LatestEONVersion.split(','); // b = EON version required by this web page for (var i = 0; i < 4; i++) { a[i] = parseInt(a[i],10); b[i] = parseInt(b[i],10); if (a[i]>b[i]) return true; // checked version higher than required if (a[i]<b[i]) return false;// checked version lower than required } return true; // eon versions are the same. } function EONReady() { if (CheckingWindow) return; if (NN) { navigator.plugins.refresh(true); if (EonXStatus==-2) CheckEonXStatus(); } return (EonXStatus==2); } function EONAlertPluginStatus() { if (CheckingWindow) return; if (NN) { navigator.plugins.refresh(true); if (EonXStatus==-2) CheckEonXStatus(); } else { if (EonXStatus==2) { if (document.body.getAttribute("eonxversioninstalled")==null) { setTimeout('EONAlertPluginStatus()', 1000); return; } else InstalledVersion = document.body.getAttribute("eonxversioninstalled") } } var t=''; if (EonXStatus==-1)t+='The EonX Plug-in is NOT supported!\nWrong platform or browser!'; if (EonXStatus==0) t+='The EonX Plug-in is NOT installed!'; if (EonXStatus==1) t+='An old EonX Plug-in is installed!'; if (EonXStatus==2) t+='The EonX Plug-in is installed!'; t+='\n\nInstalled version: ' + InstalledVersion + '\n\nRequired version: ' + LatestEONVersion; alert(t); } function EONWritePluginStatus() { if (CheckingWindow) return; if (NN) { navigator.plugins.refresh(true); if (EonXStatus==-2) CheckEonXStatus(); } else { if (EonXStatus==2) { if (document.body.getAttribute("eonxversioninstalled")==null) { setTimeout('EONWritePluginStatus()', 2000); InstalledVersion = '<span id="installedversion">? ? ? ?</span>'; } else { InstalledVersion = document.body.getAttribute("eonxversioninstalled") if (document.all('installedversion')) { document.all('installedversion').innerHTML = InstalledVersion + "*"; return; } } } } var t='<table border="0" cellpadding="10" bgcolor="#000099"><tr><td><font face="Verdana, Arial, Helvetica" size=2 color="#ffffff">'; if (EonXStatus==-1) t+='The EonX Plug-in is <b>NOT</b> supported!<br>Wrong platform or browser!'; if (EonXStatus==0) t+='The EonX Plug-in is <b>NOT</b> installed!'; if (EonXStatus==1) t+='An old EonX Plug-in is installed!'; if (EonXStatus==2) t+='The EonX Plug-in is installed!'; t+='<br>Installed version: ' + InstalledVersion + '<br>Required version: ' + LatestEONVersion + '<br></font></td></tr></table>'; document.write(t); } function errorHandler() { // ignore error messages for the hidden window. return true; } var EonXTestWin = false; function OpenCheckingWindow(nr) { EonXTestWin = open(location.href+'?eonxtest'+nr,"TestEonXWin","resizable=no,scrollbars=no,status=0,width=10,height=10,top=2000,left=2000"); } var CheckingWindow = false; if (NN) CheckAndHandleEonXStatus = CheckAndHandleEonXStatusNN; if (CheckAndHandleEonXStatus>0) { CheckEonXStatus(); if (!NN) { // Send info to eon_functions.vbs via body attributes document.write('<body eonxversion="' + LatestEONVersion+'" eonxstatus1=' +EonXStatus+' eonxcreateobject="' +eonxCreateObject+ '">'); // Check in hidden window. if ((location.href.indexOf('?eonxtest')!=-1)) { CheckingWindow=true; //document has been opened as a hidden window for checking eonx. window.onerror = errorHandler; } else OpenCheckingWindow(1); } } // --- HANDLE EONX STATUS --- // What happens when EonXStatus<>2 depends on the variable CheckAndHandleEonXStatus // 0 - Do nothing. (IE will auto install. NN will have link to PP) //*1 - Auto popup PP, TB with link. (PP=plugin page, TB=table box with info and links) // 1.1 - same as 1 but PP has stardard browser toolbar, locationbar etc // 2 - TB with link to popup PP. // 2.1 - same as 2 but PP with standard browser toolbar, locationbar etc // 3 - TB with link to PP in same window. // 4 - Auto send to PP in same window. // 5 - Alert, send to PP in same window. // 6 - Alert(Go to PP?) OK, Cancel. Ok: PP in same window. Cancel: TB like 3 // 7 - Check but do nothing. (IE will auto install. NN will have link to PP) // 8 - Get plugin here. IE:auto download & alert. NN4: alert, trigger download, TB with refresh link. NN6: TB link to EXE. // 9 - Cancel EonInsert. // 10- Call CustomEonXStatusHandler() and cancel EONInsert - Use to show alternative content. // 11- Call CustomEonXStatusHandler() but don't cancel EONInsert - For example: Use own code to check // and handle different browsers and versions or redirect to plugin or alternative content page. // 12- TB with link to download now. Link reloads using method 8. // 13- TB reports version required, version installed, link to PP in same window. // *WE RECOMMEND method 1. function HandleEonXStatus() { if (EonXStatus==2) return; if (EonXStatus==-1){document.write(InsertTextBox(-1));return;} if (location.href.indexOf('installnow=true')>0) CheckAndHandleEonXStatus=8; var n = CheckAndHandleEonXStatus; if ((n==0)|(n==7)) return; if ((n>=1)&&(n<=3)) { if ((n==1)|(n==1.1)) setTimeout('OpenEonXPluginPage()', 1500); document.write(InsertTextBox(n)); } if (n==4) GoToEonXPluginPage(); if ((n==5)|(n==6)) // redirect to plugin page in current window { var msg = "The latest version of EonX Plug-in is required to view 3D content on this page.\n\n"; msg = msg + "When you press OK, you will be redirected to a plug-in download page.\n\n"; msg = msg + "When installation is complete, press the back button to return to this page." if (n==5){alert(msg);GoToEonXPluginPage();} if ( (n==6)&&(confirm(msg)) ) GoToEonXPluginPage(); document.write(InsertTextBox(3)); } if (n==8) { if (NN) { if (is_nav6up){document.write(InsertTextBox(8.1));return;} // trigger download of Netscape plugin var trigger = netscape.softupdate.Trigger; trigger.StartSoftwareUpdate(eonxCodebaseNN, trigger.DEFAULT_MODE); // alert user that plugin is downloading alert(GetPluginMessage()); document.write(InsertTextBox(n)); } else setTimeout('IEDownloadingPluginMsg()', 1000); } if (n==9) DoEONInsert = false; if (n==10) {CustomEonXStatusHandler(); DoEONInsert = false;} if (n==11) CustomEonXStatusHandler(); if (n==12) document.write(InsertTextBox(n)); if (n==13) document.write(InsertTextBox(n)); } function InsertTextBox(n) { if (eonxWidth<240) eonxWidth=240; var t = '<table width=' + eonxWidth + ' height=' + eonxHeight + ' border=0 cellspacing=0 cellpadding=3 bgcolor="#ccccff"><tr><td><div '; if (!NN) t+='style="position:relative;overflow:auto;height:100%"'; t+='><table width=' + (parseInt(eonxWidth)-6) + ' height=' + (parseInt(eonxHeight)-6) + ' border=0 cellspacing=0 cellpadding=3 bgcolor="#eeeeff"><tr><td align="center"><font size=1 color="#000066" face="Verdana,Arial,Helvetica,san-serif"><font size=2><b>'; t+='EonX Plug-in Required!</b></font><br>To view the 3D EON content in this page,<br>'; if (n==12)t+='you need to download and install the plug-in.<br><a href="javascript:InstallEonXNow()"><font color="#000099"><b>INSTALL NOW</b></font></a><br>'; if (n==13){t+='the required version is ' + LatestEONVersion + '.<br>The installed version is ' + InstalledVersion + '. If you want,<br>';n=3} if ((n==1)|(n==1.1)) t+='the EonX Plug-in is required.<br><br>A window called "EON Download Center"<br>has been opened. To get the Plug-in,<br>please follow its instructions.<br>'; if ((n==2)|(n==2.1)) t+='you need to open the <a href="javascript:OpenEonXPluginPage()"><font color="#000099"><b>Plug-in Download</b></font></a> page.<br>'; if (n==3) t+='you can go to the <a href="javascript:GoToEonXPluginPage()"><font color="#000099"><b>Plug-in Download</b></font></a> page.<br>'; if (n==8.1)t+='you need to <a href="' + LatestEONDirectory + 'EonForNetscape6.exe"><font color="#000099"><b>Download and Install EonForNetscape6.exe</b></font></a>.<br>'; if (n==8) t+='the EON for Netscape plug-in is being downloaded.<br>When the security warning appears, click on <b>Grant</b> to continue.<br>'; if (n==-1) t+='you need to have a windows platform with at least<br>Internet Explorer 4.0 or Netscape 4.51 or later.'; if ( ((n!=-1)&&(n!=12)) | ((n==12)&&(is_nav6up)) ) { if (!NN) t+='<div id="clickhere" style="position:relative;visibility:hidden">'; t+='<br>When the installation of<br>the EonX Plug-in is complete,<br><a href="javascript:RefreshPage()"><font size=3 color="#ff0000"><b>CLICK HERE</b></font></a> to refresh this page.<br>The EON content will then appear here.<br><br>Enjoy the 3D experience!'; if (!NN) t+='</div>' if (!NN) setTimeout('document.all("clickhere").style.visibility = "visible"', 10000);} t+='</font></td></tr></table></div></td></tr></table>'; DoEONInsert = false; // TextBox replaces Eon object. return t; } function OpenEonXPluginPage() { var winsettings='toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=496,height=390'; var n=CheckAndHandleEonXStatus; if ((n==1.1)|(n==2.1)) winsettings='toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=496,height=390'; var PPwin = open(eonxPluginsPage, 'PluginPageWindow', winsettings); PPwin.focus(); } function RefreshPage() { if (location.href.indexOf("?eonxstatus")==-1) location.reload(); else location.replace(location.href.substring(0, location.href.indexOf("?eonxstatus"))); } function GoToEonXPluginPage() { location.href = eonxPluginsPage; } function IEDownloadingPluginMsg() { alert(GetPluginMessage()); } function GetPluginMessage() { var msg = 'EonX Plug-in Required!\n\nTo view the 3D EON content in this page, you need the EonX Plug-in.\nDownloading has begun...\n\nWhen the security warning dialog appears, click on '; if (NN) msg = msg + '"GRANT"'; else msg = msg + '"YES"'; msg = msg + ' to continue.' if (NN) msg = msg + '\n\nOnce installation is complete, refresh this page.'; return msg; } function InstallEonXNow() { if (is_nav6up) location.href=LatestEONDirectory + "EonForNetscape.exe"; else { if (NN) location.href = location.href + "?installnow=true"; else { var pos = location.href.substring(location.href.indexOf('?eonxstatus=')) location.href = location.href.substring(location.href, 0, pos)+'?installnow=true'; } } } // --- INSERT EON OBJECT --- // This function will insert the embed or the object tag which displays // the EON simulation. The reasons for doing this are: // 1. In Netscape, EONX will only look in the codebase given. It doesn't look // where this web page is like IE does. This function dynamically writes the // EONX object/embed tag and calculates the directory this file is in whether // it be on the Internet, a CD or local harddisk. It's called the documentbase. // Now if we move the webpage we don't have to update the path to the simulation. // 2. Saves time for the programmer to write down one set of values instead of two. // 3. Forces the use of names or id that are used in all the functions of this file. // 4. Reduces space in the webpage file. ( Write just EONInsert() instead of all below.) var DoEONInsert = true; function EONInsert() { if (CheckingWindow) return; HandleEonXStatus(); if (DoEONInsert) document.write(EONInsertText()); if (eonxAutoPlay==1) isEONrunning = true; } function EONInsertText() { if (NN) { var t= '<EMBED\n NAME="EONControl"\n TYPE="application/x-eonx"\n'; t+=' HEIGHT="' + eonxHeight + '"\n'; t+=' WIDTH="' + eonxWidth + '"\n'; t+=' CODEBASE="' + eonxCodebaseNN + '"\n'; t+=' PLUGINSPAGE="' + eonxPluginsPage + '"\n'; t+=' PARAM_Codebase="' + eonxCodebase2 + '"\n'; t+=' PARAM_AutoPlay="' + eonxAutoPlay + '"\n'; t+=' PARAM_Toolbar="' + eonxToolbar + '"\n'; t+=' PARAM_Progressbar="' + eonxProgressbar + '"\n'; t+=' PARAM_SettingsButton="' + eonxSettingsButton + '"\n'; t+=' PARAM_Background="' + eonxBackground + '"\n'; t+=' PARAM_SimulationFile="' + eonxSimulationFile + '"\n'; t+=' PARAM_PrototypebaseURL="' + eonxPrototypebaseURL + eonxServerURL + '"\n'; t+=' PARAM_SchemeValues="' + eonxSchemeValues + '"\n'; t+=' PARAM_ConfigurationScheme="' + eonxConfigurationScheme + '">'; } else { var t='<OBJECT ID="EONControl"'; t+=' TITLE="EonX ActiveX Control"'; t+=' CLASSID="' + eonxClassid + '"'; t+=' HEIGHT="' + eonxHeight + '"'; t+=' WIDTH="' + eonxWidth + '"'; t+=' CODEBASE="' + eonxCodebaseIE + '">'; t+=' <PARAM NAME="Codebase" Value="' + eonxCodebase2 + '">'; t+=' <PARAM NAME="AutoPlay" Value="' + eonxAutoPlay + '">'; t+=' <PARAM NAME="Toolbar" Value="' + eonxToolbar + '">'; t+=' <PARAM NAME="Progressbar" Value="' + eonxProgressbar + '">'; t+=' <PARAM NAME="SettingsButton" Value="' + eonxSettingsButton + '">'; t+=' <PARAM NAME="Background" Value="' + eonxBackground + '">'; t+=' <PARAM NAME="SimulationFile" Value="' + eonxSimulationFile + '">'; t+=' <PARAM NAME="PrototypebaseURL" Value="' + eonxPrototypebaseURL + eonxServerURL + '">'; t+=' <PARAM NAME="SchemeValues" Value="' + eonxSchemeValues + '">'; t+=' <PARAM NAME="ConfigurationScheme" Value="' + eonxConfigurationScheme + '">'; t+='</OBJECT>'; // The following code will insert hidden form fields which are neccessary // to allow communication between vbscript and javascript and vice versa; // The tags should never be a problem becuase they are in a hidden div far // to the left of the page. (It hasn't been tested yet on early browsers.) // These fields allow all events from EON to be handled by one javascript // function called EON_OnEvent(e,v) and they allow all events to EON to be // sent using javascript only. (eon_functions.vbs external script is required.) t+='<div style="position:absolute;visibility:hidden; left:-1000 px;">'; t+='<form name="eonhiddenfields">'; t+='<input type="hidden" name="EONInEventType">'; t+='<input type="hidden" name="EONInEventName">'; t+='<input type="hidden" name="EONInEventV1">'; t+='<input type="hidden" name="EONInEventV2">'; t+='<input type="hidden" name="EONInEventV3">'; t+='<input type="hidden" name="EONInEventV4">'; t+='<input type="hidden" name="EONOutEventType">'; t+='<input type="hidden" name="EONOutEventName" onclick="EONOutEventName_OnClick()">'; t+='<input type="hidden" name="EONOutEventV1">'; t+='<input type="hidden" name="EONOutEventV2">'; t+='<input type="hidden" name="EONOutEventV3">'; t+='<input type="hidden" name="EONOutEventV4">'; t+='</form></div>'; } return t; } // --- EONX METHODS --- (Start, Stop, Pause, ShowSettingsDialog, Fullsize) // This variable is used in the SimulationFile function to determine // if the simulation should be stopped and restarted. var isEONrunning = false; // This function starts a simulation function EONStart() { (NN) ? document.EONControl.Start() : EONControl.Start(); isEONrunning = true; setTimeout("if (ToolOpen) WEBEON.focus()", 1000); // for WEBEON Tool's purpose } // This function stops a simulation function EONStop() { (NN) ? document.EONControl.Stop() : EONControl.Stop(); isEONrunning = false; EONBackground(eonxBackground); } // This function pauses and unpauses a simulation. function EONPause(v) { (NN) ? document.EONControl.Pause(v) : EONControl.Pause(v); } // This function will show the EON Configuration dialog function EONShowSettingsDialog() { (NN) ? document.EONControl.ShowSettingsDialog() : EONControl.ShowSettingsDialog() } // This function can both set the FullSize Mode and get its value function EONFullsize(v) { if (v == null) // if no v was sent then we are getting it instead of setting it. { if (NN) { if (document.EONControl.GetFullsize()) return 1; return 0; } else { return EONControl.GetFullsize(); } } else // setting the FullSize mode { if (NN) {document.EONControl.SetFullsize(v);} else {EONControl.SetFullsize(v);} } } // This function saves a picture of the running simulation to a specific location function EONSaveSnapshot(v) { if (v==null) // Press 444 to automatically call this function { // use this to see the file: '<img src="file:///c://eonx.png">' if (NN) document.EONControl.SaveSnapshot("C://eonx.png"); else EONControl.SaveSnapshot("C://eonx.png"); } else { if (NN) document.EONControl.SaveSnapshot(v); else EONControl.SaveSnapshot(v); } } // --- OLD EONX PROPERTIES --- (Toolbar, ProgressBar, SettingsButton, AutoPlay) // (SimulationFile, Background, Codebase, Height, Width) // This function can both set or get the value of the Toolbar function EONToolbar(v) { if (v == null) // if no v was sent then we are getting it instead of setting it. { if (NN) { if (document.EONControl.GetToolbar()) return 1; return 0; } else { if (EONControl.Toolbar == -1) return 1; return EONControl.Toolbar ; } } else // setting the Toolbar { if (NN) {document.EONControl.SetToolbar(v);} else {EONControl.Toolbar = v;} } } // This function can both set or get the value of the progressbar function EONProgressbar(v) { if (v == null) // if no v was sent then we are getting it instead of setting it. { if (NN) { if (document.EONControl.GetProgressbar()) return 1; return 0; } else { if (EONControl.Progressbar == -1) return 1; return EONControl.Progressbar ; } } else // setting the Progressbar { if (NN) {document.EONControl.SetProgressbar(v)} else {EONControl.Progressbar = v} } } // This function can both set or get the value of the Settingsbutton function EONSettingsButton(v) { if (v == null) // if no v was sent then we are getting it instead of setting it. { if (NN) { if (document.EONControl.GetSettingsButton()) return 1; return 0; } else { if (EONControl.SettingsButton == -1) return 1; return EONControl.SettingsButton ; } } else // setting the SettingsButton { if (NN) {document.EONControl.SetSettingsButton(v)} else {EONControl.SettingsButton = v} } } // This function can both set or get the value of the Autoplay property. // Setting the autoplay property will have no effect though since then it wouldn't be automatic! function EONAutoPlay(v) { if (v == null) // if no v was sent then we are getting it instead of setting it. { if (NN) { if (document.EONControl.GetAutoPlay()) return 1; return 0; } else { if (EONControl.AutoPlay == -1) return 1; return EONControl.AutoPlay ; } } else // setting the value { if (NN) {document.EONControl.SetAutoPlay(v)} else {EONControl.AutoPlay = v} } } // This function can both set or get the value of the SimulationFile // When setting it checks that the simulation file is different from the existing // file and if the simulation is running it will stop it, change files and restart it. // If it isn't running it will only change the file. function EONSimulationFile(v) { if (v == null) // if no v was sent then we are getting it instead of setting it. { if (NN) {return document.EONControl.GetSimulationFile();} else {return EONControl.SimulationFile;} } else // Setting the value of the Simulation file { if (v != (EONSimulationFile())) { var s = false; if (isEONrunning) { EONStop(); var s = true; } if (NN) {document.EONControl.SetSimulationFile(v)} else {EONControl.SimulationFile = v;} if (s) EONStart(); } } } // This function can both set or get the value of the Background function EONBackground(v) { if (v == null) // if no v was sent then we are getting it instead of setting it. { if (NN) {return document.EONControl.GetBackground();} else {return EONControl.Background;} } else // Setting the background { if (isEONrunning) { eonxBackground = v; return; } if (NN) {document.EONControl.SetBackground(v);} else {EONControl.Background = v;} } } // This function can both set or get the value of the Codebase // This codebase is where the simulation files and background files are kept. function EONCodebase(v) { if (v == null) // if no v was sent then we are getting it instead of setting it. { if (NN) {return document.EONControl.GetCodebase()} else {return EONControl.Codebase;} } else { if (isEONrunning) return; if (NN) {document.EONControl.SetCodebase(v)} else {EONControl.Codebase = v} } } // This function will get or set the width of the simulation. function EONWidth(v) { if (v == null) { if (NN){return eonxWidth;} else {return EONControl.width;} } else // setting the width (IE only) { if (!NN) {EONControl.width = v;} } } // This function will get or set the height of the simulation. function EONHeight(v) { if (v == null) { if (NN) {return eonxHeight;} else {return EONControl.height;} } else { if (!NN){EONControl.height = v;} } } // --- NEW EONX PROPERTIES --- (Version, PrototypebaseURL, SchemeValues, ConfigurationScheme) // This function will return, as an array, which version of EON is installed. function EONGetVersionArray() { if(NN) { return document.EONControl.Version(); } else { var verArray = EONControl.Version; if(verArray==null) {return new Array("not available");} else {return verArray.toArray();} } } // This function will return a string stating which version of EON is installed. function EONGetVersion() { var verArray = EONGetVersionArray() if (verArray[0] == "not available") {return "EonX version not available";} else {return "EonX version " + verArray[0] + "." + verArray[1] + "." + verArray[2]+ "." + verArray[3];} } // This function will get the PrototypebaseURL property function EONPrototypebaseURL() { if (NN) {return document.EONControl.GetPrototypebaseURL();} else {return EONControl.PrototypebaseURL;} } // This function will get the SchemeValues property function EONSchemeValues() { if (NN) {return document.EONControl.GetSchemeValues();} else {return EONControl.SchemeValues;} } // This function will get the ConfigurationScheme property function EONConfigurationScheme() { if (NN) {return document.EONControl.GetConfigurationScheme();} else {return EONControl.ConfigurationScheme;} } // --- SENDING and RECIEVING EVENTS --- // This function will send events to EON. In the case of IE the data will // first be sent to HTML Elements to then be picked up by vbscript and then // sent to EON. (See the EONInEventName_OnClick subroutine in eon_functions.vbs) function EONSendEvent(type, e, v1, v2, v3, v4) { // Send error if type is not recognized type=type.toUpperCase() datatypes = "SFBOOL, SFCOLOR, SFFLOAT, SFIMAGE, SFINT32, SFNODE, SFROTATION, SFSTRING, SFTIME, SFVEC2F, SFVEC3F"; if (datatypes.indexOf(type)==-1) { alert("Unrecognized EON datatype '" + type + "'"); } if ((typeof(v1)=="string")&&(v2==null)) { var simpletypes = "SFBOOL, SFFLOAT, SFIMAGE, SFINT32, SFNODE, SFSTRING, SFTIME" if (simpletypes.indexOf(type)!=-1) { if (type=="SFBOOL") { if ((v1=="true")||(v1=="True")||(v1=="TRUE")) {v1=true}else{v1=false} } if ((type=="SFFLOAT")||(type=="SFINT32")||(type=="SFTIME")){v1=Number(v1)} } else { var b = v1.split(" "); if ((b.length>=2)&&(b.length<=4)) { v1=Number(b[0]); v2=Number(b[1]); if ((b.length==3)&&((type=="SFCOLOR")||(type=="SFVEC3F"))) v3=Number(b[2]); if ((b.length==4)&&(type=="SFROTATION")) {v3=Number(b[2]);v4=Number(b[3]);} } } } if (NN) { var args = new Array(type, v1, v2, v3, v4); document.EONControl.SendEvent(e, args); } else { document.eonhiddenfields.EONInEventType.value = type; document.eonhiddenfields.EONInEventName.value = e; document.eonhiddenfields.EONInEventV1.value = v1; document.eonhiddenfields.EONInEventV2.value = v2; document.eonhiddenfields.EONInEventV3.value = v3; document.eonhiddenfields.EONInEventV4.value = v4; // Logging for WEB-EON TOOL's purpose Logcount ++ if (LogActive) WEBEON.LogEONEvent(Logcount, "in", e, v1, v2, v3, v4) document.eonhiddenfields.EONInEventName.click(); } } // This next function is for receiving events from EON when using IE. // The event has already been accepted by VBScript and put into the hidden field // This function gets the values and sends them to a common function for both // Netscape and IE browsers called EON_OnEvent(e,v). function EONOutEventName_OnClick() { var t = document.eonhiddenfields.EONOutEventType.value; var e = document.eonhiddenfields.EONOutEventName.value; if (t == 0) { var v = document.eonhiddenfields.EONOutEventV1.value; // Logging for WEB-EON TOOL's purpose. Logcount ++ if (LogActive) WEBEON.LogEONEvent(Logcount, "out", e, v) EON_OnEvent(e,v); } else { // Logging for WEB-EON TOOL's purpose. Logcount ++ var v = new Array(t + 1); if (t == 1) { v[0] = document.eonhiddenfields.EONOutEventV1.value v[1] = document.eonhiddenfields.EONOutEventV2.value // Logging for WEB-EON TOOL's purpose. if (LogActive) WEBEON.LogEONEvent(Logcount, "out", e, v[0],v[1]) } if (t == 2) { v[0] = document.eonhiddenfields.EONOutEventV1.value v[1] = document.eonhiddenfields.EONOutEventV2.value v[2] = document.eonhiddenfields.EONOutEventV3.value // Logging for WEB-EON TOOL's purpose. if (LogActive) WEBEON.LogEONEvent(Logcount, "out", e, v[0],v[1],v[2]) } if (t == 3) { v[0] = document.eonhiddenfields.EONOutEventV1.value v[1] = document.eonhiddenfields.EONOutEventV2.value v[2] = document.eonhiddenfields.EONOutEventV3.value v[3] = document.eonhiddenfields.EONOutEventV4.value // Logging for WEB-EON TOOL's purpose. if (LogActive) WEBEON.LogEONEvent(Logcount, "out", e, v[0],v[1],v[2],v[3]) } EON_OnEvent(e, v); } } // This function recieves events directly from EON when using Netscape // It will send the event on to the common function for both Netscape and IE // called EON_OnEvent(e,v). (No logging because the WEBEON tool is not designed for NN) function EONControl_OnEvent(e,v) { var ev = String(e); var arraytypes = " SFCOLOR, SFROTATION, SFVEC2F, SFVEC3F "; if (arraytypes.indexOf(EONGetDataType(e))!=-1) { var arrlen = v.length; var v1 = v[0]; var v2 = v[1]; TheArray = new Array(arrlen); TheArray[0] = v1; TheArray[1] = v2; if (arrlen >= 3) { var v3 = v[2]; TheArray[2] = v3; if (arrlen == 4) { var v4 = v[3]; TheArray[3] = v4; } } EON_OnEvent(ev,TheArray); } else { var v1 = String(v); // this is to make the value of the same type as it is in IE. EON_OnEvent(ev, v1); } } // --- METHODS FOR GETTING IN/OUT EVENT INFORMATION --- // This returns the number of IN events for the running simulation. function EONGetNumberOfInEvents() { if (NN) {return document.EONControl.GetNumberOfInEvents();} else {return EONControl.GetNumberOfInEvents();} } // This returns the number of OUT events for the running simulation. function EONGetNumberOfOutEvents() { if (NN) {return document.EONControl.GetNumberOfOutEvents();} else {return EONControl.GetNumberofOutEvents();} } // This function gets the name of an inevent given its position in the list of inevents. function EONGetInEventName(i) { if (NN) {return document.EONControl.GetInEventName(i);} else {return EONControl.GetInEventName(i);} } // This function gets the name of an outevent given its position in the list of outevents. function EONGetOutEventName(i) { if (NN) {return document.EONControl.GetOutEventName(i);} else {return EONControl.GetOutEventName(i);} } // Given the events position in the list of inevents, this function gets // an integer of an inevent which represents its datatype. function EONGetInEventType(i) { if (NN) {return document.EONControl.GetInEventType(i);} else {return EONControl.GetInEventType(i);} } // Given the events position in the list of outevents, this function gets // an integer of an outevent which represents its datatype. function EONGetOutEventType(i) { if (NN) {return document.EONControl.GetOutEventType(i);} else {return EONControl.GetOutEventType(i);} } // There are 22 EON datatypes. Other functions will give you an integer // representing a datatype. By using that integer in this function you will // return a string like "SFBOOL" or "SFVEC3F". // HOWEVER this function will also accept a string representing the name of the // inevent or outevent and still return a string like "SFBOOL" or "SFVEC3F". function EONGetDataType(p) { var EONdatatypes = new Array("SFBOOL", "SFCOLOR", "SFFLOAT", "SFIMAGE", "SFINT32", "SFNODE", "SFROTATION", "SFSTRING", "SFTIME", "SFVEC2F", "SFVEC3F", "MFBOOL", "MFCOLOR", "MFFLOAT", "MFIMAGE", "MFINT32", "MFNODE", "MFROTATION", "MFSTRING", "MFTIME", "MFVEC2F", "MFVEC3F"); if ((p >= 0) && (p <= 21)) // p is integer { return EONdatatypes[p]; } else // p is probably an inevent name or an outevent name { p=String(p) var n = EONGetNumberOfInEvents(); for (var i=0 ; i<n ; i++ ) { if ((p.toUpperCase()) == (String((EONGetInEventName(i)).toUpperCase()))) { return EONdatatypes[EONGetInEventType(i)]; } } n = EONGetNumberOfOutEvents(); for (var i=0 ; i<n ; i++ ) { if ((p.toUpperCase()) == (String((EONGetOutEventName(i)).toUpperCase()))) { return EONdatatypes[EONGetOutEventType(i)]; } } return "not found"; } } // --- WEBEON TOOL CODE --- // This next code is designed to open the WEB-EON Tool when the user // presses 3 times on the number 5 key. document.onkeypress = KeyPressed; var sixcount = 0; var fourcount = 0; function KeyPressed(e) { if (NN) { if (e.which == 52) {fourcount ++;} else {fourcount = 0;} } else { e = window.event; if (e.keyCode == 53) {sixcount ++;} else {sixcount = 0;} if (e.keyCode == 52) {fourcount ++;} else {fourcount = 0;} } if ((sixcount == 3)&&(!NN)) { sixcount=0; if (EnableWEBEON_Tool) OpenWEBEON(); } if (fourcount==3) { fourcount=0; EONSaveSnapshot(); } } var WEBEON = "nothin"; var ToolOpen = false; function OpenWEBEON() { if (!NN) WEBEON = open("WEBEON_Tool.html","webeon", "resizable=yes,scrollbars=no,status=0,width=470,height=320"); } window.onunload = ClosingPage; function ClosingPage() { if (ToolOpen) WEBEON.PageOpen = false; if (ToolOpen) WEBEON.close(); } // The LogActive variable will be set to true by the WEB-EON tool. var Logcount = 0; var LogActive = false; // BACKWARD COMPATIBILTY // These functions, variables, are here for backwards compatibility. // If they are removed some older web pages will NOT work. function DownloadEONforNetscapeSmartUpdateUsers() {} function ShowUserInfoWhenEONIsNotSupported() {} var eonxServerURL = ''; //End of file3.eon_functions.vbs
' Last modified Sept 13, 2002 sub EONControl_OnEvent(e,v) 'This subroutine receives events from EON and will send the events to HTML elements 'which will be picked up by javascript and sent to the javascript function that 'handles EONs Outevents. That function is called EONEmbed_OnEvent(e,v) if IsArray(v) then j=Ubound(v) document.eonhiddenfields.EONOutEventType.value = j document.eonhiddenfields.EONOutEventName.value = e document.eonhiddenfields.EONOutEventV1.value = v(0) if j >=1 then document.eonhiddenfields.EONOutEventV2.value = v(1) if j>=2 then document.eonhiddenfields.EONOutEventV3.value = v(2) if j>=3 then document.eonhiddenfields.EONOutEventV4.value = v(3) end if end if end if else document.eonhiddenfields.EONOutEventType.value = "0" document.eonhiddenfields.EONOutEventName.value = e document.eonhiddenfields.EONOutEventV1.value = v end if document.eonhiddenfields.EONOutEventName.Click() end sub sub EONInEventName_OnClick() ' Javascript cannot send events to EON that have arrays as values. ' Therefore javascript sent them to HTML Elements and now this subroutine ' gathers the values and sends them to EON. For simplicity all EON events ' of every EON datatype are sent via this subroutine when IE is used. dim t, e, v1 t = document.eonhiddenfields.EONInEventType.value e = document.eonhiddenfields.EONInEventName.value v1 = document.eonhiddenfields.EONInEventV1.value simpletypes = "SFBOOL, SFFLOAT, SFIMAGE, SFINT32, SFNODE, SFSTRING, SFTIME" if InStr(simpletypes, t) > 0 then if t="SFBOOL" then if v1= "true" then v1= true else v1=false end if call EONControl.SendEvent(e,v1) else dim v2, v3, v4 v2 = document.eonhiddenfields.EONInEventV2.value v3 = document.eonhiddenfields.EONInEventV3.value v4 = document.eonhiddenfields.EONInEventV4.value Dim TheArray(3) TheArray(0) = v1 TheArray(1) = v2 TheArray(2) = v3 TheArray(3) = v4 call EONControl.SendEvent(e, TheArray) end if end sub function GetEonXStatusIE() On Error Resume Next dim obj, v, ver v=0 set obj=CreateObject(document.body.getAttribute("eonxCreateObject")) if IsObject(obj) then v=1 ver = obj.version if ver<>Null then InstalledVersionIE = ver(0) & "," & ver(1) & "," & ver(2) & "," & ver(3) if VersionOKIE(InstalledVersionIE)=true then v=2 else InstalledVersionIE = "unknown" if VersionOKIE("3,0,1,75")=true then v=2 end if end if set obj = Nothing CollectGarbage GetEonXStatusIE=v end function function VersionOKIE(str) a = split(str, ",") b = split(document.body.getAttribute("eonxversion"), ",") for i = 0 to 3 a(i) = CInt(a(i)) b(i) = CInt(b(i)) if a(i)>b(i) then VersionOKIE=true 'version higher than required Exit Function end if if a(i)<b(i) then VersionOKIE=false 'version lower than required Exit Function end if next VersionOKIE=true 'same versions end function sub CheckEonXStatusIE() document.title="EonX Test" dim AssumeStatus AssumeStatus = CInt(document.body.getAttribute("eonxstatus1")) dim EonXStatusIE if (AssumeStatus<>-1) then EonXStatusIE=GetEonXStatusIE() else EonXStatusIE=-1 if (InStr(location.href, "?eonxtest1")>0) then if EonXStatusIE=2 and (AssumeStatus=0 or AssumeStatus=1) then window.opener.location.replace(Mid(window.opener.location.href, 1, InStr(window.opener.location.href, "?eonxstatus=")-1)) if AssumeStatus=2 and (EonXStatusIE=0 or EonXStatusIE=1) then window.opener.location.replace(window.opener.location.href & "?eonxstatus=" & EonXStatusIE & "&eonxver=" & InstalledVersionIE) else window.opener.document.body.setAttribute "eonxversioninstalled", InstalledVersionIE end if elseif (InStr(location.href, "?eonxtest2")>0) then window.opener.document.body.setAttribute "eonxstatus2", EonXStatusIE window.opener.document.body.setAttribute "eonxversioninstalled", InstalledVersionIE end if close() end sub dim InstalledVersionIE InstalledVersionIE = "nothing" if (InStr(location.href, "?eonxtest")>0) then CheckEonXStatusIE()
相关文章推荐
- html文件中flash视频格式(flv、swf)文件的嵌入方法
- html文件中flash视频格式(flv、swf)文件的嵌入方法
- html文件中flash视频格式(flv、swf)文件的嵌入方法
- 给C#程序加壳(C# 调用嵌入资源的EXE文件方法)
- 黄聪:将C#程序嵌入资源中(C# 调用嵌入资源的EXE文件方法)
- datagrid数据导出到excel文件给客户端下载的几种方法 (xls,csv,html)
- java中使用String的replace方法替换html模板保存文件
- html中嵌入swf文件的几种方法
- JAVA读取WORD,EXCEL,PDF,TXT,RTF,HTML文件文本内容的方法
- HTML中引入CSS文件的几种方法
- Oracle EBS OAF嵌入HTML方法
- 在freemarker的模板文件中调用自定义的方法--http://hi.baidu.com/wadise/blog/item/2467d8339985ed44ad4b5fb3.html
- HTML里面include其他文件的方法
- 为什么在.html文件中嵌入php代码没效果
- 在 Soui 中嵌入 MiniBlink 初体验(二):解决本地 Html 文件显示 ECharts 失败的问题
- Silverlight嵌入HTML和Flash和PDF文件
- datagrid数据导出到excel文件给客户端下载的几种方法 (xls,csv,html)
- iOS之在webView中引入本地html,image,js,css文件的方法
- HTML里面include其他文件的方法
- 在asp.net中读取XML文件信息的4种方法 (http://www.cnblogs.com/liping19851014/archive/2007/10/16/926137.html)