Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- frontend.html + utils.js with backend python script coefficient.py
- <head>
- <script type="text/javascript" src="utils.js"></script>
- </head>
- <body>
- <center>
- <h2> Newtonian Coefficient</h2>
- <p/>
- <input type="text" name="filename" value="input.dat" onblur="ClearDefValue (this)" onfocus="SetDefValue (this)" />
- <input type="button" width="15" value="run" onclick="RunExe();"/></input>
- </p>
- <div style="display: block; width: 100px; height: 20px; overflow: hidden;">
- <button style="width: 110px; height: 30px; position: relative; top: -5px; left: -5px;">
- <a href="javascript: void(0)">Upload File</a></button>
- <input type="file" id="upload_input" name="upload" style="font-size: 50px; width: 120px; opacity: 0; filter:alpha(opacity: 0); position: relative; top: -40px;; left: -20px" />
- </div>
- <script type="text/javascript">
- function RunExe()
- {
- alert("In fun RunExe()..");
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- alert("Done");
- var exe = window.Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
- exe.initWithPath("coefficient.py");
- alert("exe");
- var run = window.Components.classes['@mozilla.org/process/util;1'].createInstance(Components.interfaces.nsIProcess);
- run.init(exe);
- var parameters = [""];
- run.run(false, parameters,parameters.length);
- alert("in function RunBat");
- }
- <b> kappa front end study </b><br>
- </center>
- </body>
- Utils.js
- function ClearDefValue (input) {
- if (input.value == '') {
- input.value = input.defaultValue;
- }
- }
- function SetDefValue (input) {
- if (input.value == input.defaultValue) {
- input.value = '';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement