I have a script that I am working on for an intranet tool and in this
script I have a form, which when submitted the onSubmit command calls
calculate(). In this calculate function, I have it do some calculations
and write out a new document using document.write(). One of the lines
it writes is (the whole script is at the bottom of this email).
pageData = PageData+"<b>Patient Data</b><br>Wt: "+weight+"
"+weightUnits+"    Ht: "+height+"in    Gender:
"+gender+"<br><a href=\"index.html\">Back To Form</a>";
When I click on this link to "reload" the page and have the original
form show up again, it works but in the javascript console i get errors
saying:
-The link to
file:///C:/Server/Apache%20Group/Apache2/htdocs/heparin/index.html was
blocked by the security manager.
Remote content may not link to local content.
-Error: uncaught exception: Load of
file:///C:/Server/Apache%20Group/Apache2/htdocs/heparin/index.html denied.
The basic goal of the link is to destory the page that was written by
the funtion and to just display the form again.
I am not a computer programmer by training, so maybe I am going about
this wrong. Please let me know how to get rid of these error messages.
If you have any other tips on things that I am doing strange in this
script, let me know. I am fairly familier with java and PHP, but this
is my first real dealings with javascript.
Thanks,
Andrew V. Romero
--The Whole Script--
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Andrew V. Romero" content="romero">
<meta name="GENERATOR" content="Mozilla/4.7 [en] (Win98; U) [Netscape]">
<title>UMC Out of Range Heparin Protocol</title>
</head><body background="coctail3.gif" link="#0000DD" vlink="#0000DD"
alink="#0000DD">
<center><font size=+3>UMC Demo Heparin Protocol</font><font
size=+3></font></center><br>
<script language="JavaScript">
function calculate()
{
if (document.form.weight.value != "" && document.form.height.value !=
"" && document.form.age.value != "")
{
//0 is kg
if (document.form.wtUnits[0].checked)
{
weight = document.form.weight.value;
weightUnits = "kg"
}
else if (document.form.wtUnits[1].checked)
{
weight = document.form.weight.value / 2.2
weightUnits = "lbs"
}
height = document.form.height.value;
age = document.form.age.value;
var rate;
var gender;
var bolus;
//for males
if (document.form.gender[0].checked)
{
gender = "male"
//AMI
if (document.form.diagnosis[0].checked)
{
rate = -336.4 + (6.52*weight) + (22*height) - (7.52*age)
}
//USA
else if (document.form.diagnosis[1].checked)
{
rate = -336.4 + (6.52*weight) + (22*height) - (7.52*age) - 142
}
//AFib
else if (document.form.diagnosis[2].checked)
{
rate = -336.4 + (6.52*weight) + (22*height) - 7.52 - 142
}
}
//for females
else if (document.form.gender[1])
{
gender = "female"
//AMI
if (document.form.diagnosis[0].checked)
{
rate = -336.4 + (6.52*weight) + (22*height) + (2.71*age) - 749.2
}
//USA
else if (document.form.diagnosis[1].checked)
{
rate = -336.4 + (6.52*weight) + (22*height) + (2.71*age) - 672.3
}
//AFib
else if (document.form.diagnosis[2].checked)
{
rate = -336.4 + (6.52*weight) + (22*height) + (2.71*age) - 672.3
}
}
//AMI USA or AFib bolus
if (document.form.diagnosis[0] || document.form.diagnosis[1] ||
document.form.diagnosis[2])
{
//want bolus
if (document.form.bolus[0].checked)
{
bolus = 50 * weight;
}
//doesn't want bolus
else if (document.form.bolus[1].checked)
bolus = "No Bolus Requested";
}
//DVT and PE bolus and infusion
if (document.form.diagnosis[3].checked)
{
alert("test");
rate = 18 * weight;
//if want bolus
if (document.form.bolus[0].checked)
{
bolus = 80 * weight;
}
//doesn't want bolus
else if (document.form.bolus[1].checked)
bolus = "No Bolus Requested";
}
var pageData;
pageData = "<html><head><meta http-equiv=\"Content-Type\"
content=\"text/html; charset=iso-8859-1\"><meta name=\"Andrew V.
Romero\" content=\"romero\"><title>UMC Out of Range Heparin
Protocol</title></head><body background=\"coctail3.gif\"
link=\"#0000DD\" vlink=\"#0000DD\" alink=\"#0000DD\"><center><font
size=+3>UMC Demo Heparin Protocol</font><font size=+3></font></center>";
pageData = PageData+"<b>Patient Data</b><br>Wt: "+weight+"
"+weightUnits+"    Ht: "+height+"in    Gender:
"+gender+"<br><a href=\"index.html\">Back To Form</a>";
alert ("Infusion Rate: "+rate+" units/hr "+gender);
document.write(pageData);
document.close();
}
else
alert ("Please Fill In All Fields");
}
</script>
<form name="form" method="get" action="" onSubmit=calculate();>
<table border =1>
<tr><td colspan=3><b>Patient Data</b></td></tr>
<tr><td><b>Weight (kg)</b></td><td><input name="weight" size=5><input
type="radio" name="wtUnits" value="kg" checked>Kg   <input
type="radio" name="wtUnits" value="lb">lbs</td></tr>
<tr><td><b>Height (in)</b></td><td><input name="height" size=3></td></tr>
<tr><td><b>Age</b></td><td><input name="age" size=3></td></tr>
<tr><td><b>Gender</b></td><td><input type="radio" name="gender"
value="male" checked>Male    <input type="radio" name="gender"
value="female">Female</td></tr>
<tr><td><b>Diagnosis</b> </td><td><input type="radio" name="diagnosis"
value="AMI" checked>AMI    <input type="radio" name="diagnosis"
value="USA">USA    <input type="radio" name="diagnosis"
value="AFib">Afib   <input type="radio" name="diagnosis"
value="DVTorPE">DVT or PE</td></tr>
<tr><td><b>Bolus</b></td><td><input type="radio" name="bolus"
value="yes" checked>Yes    <input type="radio" name="bolus"
value="no">No</td></tr>
</table>
<div align=right><br><input TYPE = "submit" Value = " Calculate
"></div></form>
<hr><br>
</form>
</body>
</html> 1 2326
opps, part of my code was wrong when I cut and pasted the line pageData
= PageData+"<b>Patient Data</b><br>Wt: "+weight+".... should be pageData
= pageData... The problem still exist when I fixed this error.
Thanks,
Andrew V. Romero
Andrew V. Romero wrote: I have a script that I am working on for an intranet tool and in this script I have a form, which when submitted the onSubmit command calls calculate(). In this calculate function, I have it do some calculations and write out a new document using document.write(). One of the lines it writes is (the whole script is at the bottom of this email). pageData = PageData+"<b>Patient Data</b><br>Wt: "+weight+" "+weightUnits+"    Ht: "+height+"in    Gender: "+gender+"<br><a href=\"index.html\">Back To Form</a>";
When I click on this link to "reload" the page and have the original form show up again, it works but in the javascript console i get errors saying: -The link to file:///C:/Server/Apache%20Group/Apache2/htdocs/heparin/index.html was blocked by the security manager. Remote content may not link to local content.
-Error: uncaught exception: Load of file:///C:/Server/Apache%20Group/Apache2/htdocs/heparin/index.html denied.
The basic goal of the link is to destory the page that was written by the funtion and to just display the form again. I am not a computer programmer by training, so maybe I am going about this wrong. Please let me know how to get rid of these error messages. If you have any other tips on things that I am doing strange in this script, let me know. I am fairly familier with java and PHP, but this is my first real dealings with javascript.
Thanks, Andrew V. Romero
--The Whole Script-- <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="Andrew V. Romero" content="romero"> <meta name="GENERATOR" content="Mozilla/4.7 [en] (Win98; U) [Netscape]"> <title>UMC Out of Range Heparin Protocol</title> </head><body background="coctail3.gif" link="#0000DD" vlink="#0000DD" alink="#0000DD"> <center><font size=+3>UMC Demo Heparin Protocol</font><font size=+3></font></center><br>
<script language="JavaScript">
function calculate() { if (document.form.weight.value != "" && document.form.height.value != "" && document.form.age.value != "") { //0 is kg if (document.form.wtUnits[0].checked) { weight = document.form.weight.value; weightUnits = "kg" } else if (document.form.wtUnits[1].checked) { weight = document.form.weight.value / 2.2 weightUnits = "lbs" }
height = document.form.height.value; age = document.form.age.value;
var rate; var gender; var bolus;
//for males if (document.form.gender[0].checked) { gender = "male" //AMI if (document.form.diagnosis[0].checked) { rate = -336.4 + (6.52*weight) + (22*height) - (7.52*age) } //USA else if (document.form.diagnosis[1].checked) { rate = -336.4 + (6.52*weight) + (22*height) - (7.52*age) - 142 } //AFib else if (document.form.diagnosis[2].checked) { rate = -336.4 + (6.52*weight) + (22*height) - 7.52 - 142
} }
//for females else if (document.form.gender[1]) { gender = "female" //AMI if (document.form.diagnosis[0].checked) { rate = -336.4 + (6.52*weight) + (22*height) + (2.71*age) - 749.2 } //USA else if (document.form.diagnosis[1].checked) { rate = -336.4 + (6.52*weight) + (22*height) + (2.71*age) - 672.3 } //AFib else if (document.form.diagnosis[2].checked) { rate = -336.4 + (6.52*weight) + (22*height) + (2.71*age) - 672.3 } }
//AMI USA or AFib bolus if (document.form.diagnosis[0] || document.form.diagnosis[1] || document.form.diagnosis[2]) { //want bolus if (document.form.bolus[0].checked) { bolus = 50 * weight; } //doesn't want bolus else if (document.form.bolus[1].checked) bolus = "No Bolus Requested"; }
//DVT and PE bolus and infusion if (document.form.diagnosis[3].checked) { alert("test"); rate = 18 * weight; //if want bolus if (document.form.bolus[0].checked) { bolus = 80 * weight; } //doesn't want bolus else if (document.form.bolus[1].checked) bolus = "No Bolus Requested"; }
var pageData; pageData = "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"><meta name=\"Andrew V. Romero\" content=\"romero\"><title>UMC Out of Range Heparin Protocol</title></head><body background=\"coctail3.gif\" link=\"#0000DD\" vlink=\"#0000DD\" alink=\"#0000DD\"><center><font size=+3>UMC Demo Heparin Protocol</font><font size=+3></font></center>"; pageData = PageData+"<b>Patient Data</b><br>Wt: "+weight+" "+weightUnits+"    Ht: "+height+"in    Gender: "+gender+"<br><a href=\"index.html\">Back To Form</a>"; alert ("Infusion Rate: "+rate+" units/hr "+gender);
document.write(pageData); document.close(); }
else alert ("Please Fill In All Fields"); } </script>
<form name="form" method="get" action="" onSubmit=calculate();> <table border =1> <tr><td colspan=3><b>Patient Data</b></td></tr> <tr><td><b>Weight (kg)</b></td><td><input name="weight" size=5><input type="radio" name="wtUnits" value="kg" checked>Kg   <input type="radio" name="wtUnits" value="lb">lbs</td></tr> <tr><td><b>Height (in)</b></td><td><input name="height" size=3></td></tr> <tr><td><b>Age</b></td><td><input name="age" size=3></td></tr> <tr><td><b>Gender</b></td><td><input type="radio" name="gender" value="male" checked>Male    <input type="radio" name="gender" value="female">Female</td></tr> <tr><td><b>Diagnosis</b> </td><td><input type="radio" name="diagnosis" value="AMI" checked>AMI    <input type="radio" name="diagnosis" value="USA">USA    <input type="radio" name="diagnosis" value="AFib">Afib   <input type="radio" name="diagnosis" value="DVTorPE">DVT or PE</td></tr> <tr><td><b>Bolus</b></td><td><input type="radio" name="bolus" value="yes" checked>Yes    <input type="radio" name="bolus" value="no">No</td></tr> </table> <div align=right><br><input TYPE = "submit" Value = " Calculate "></div></form> <hr><br>
</form> </body> </html> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Peter |
last post by:
Hello,
First of all, sorry for all the code. I don't know how to explain my
problem without it.
I have a javascript function which can build a webpage dynamically. A
striped down version of...
|
by: Ari Royce Hidayat |
last post by:
Dear ALL,
Is there some one ever faces this problem? And fix it?
The scenario is:
There's an html page that hosts a .net object (using
object tag), and this page opens the second html page...
|
by: Ari Royce Hidayat |
last post by:
Tx a lot for idea.
I've tried it, and still get not clue what causes it.
I also tried to see the log file generated by IEHost (by
adding IEHostLogFile to registry) and still get not clue
what...
|
by: Jim Marquardson |
last post by:
Hi,
I've struggled with this for a while now, so I'm asking for help. I
am trying to click on a link in one page, have that link open up in a
new window, and set that newly opened window's...
|
by: jrefactors |
last post by:
I have an upload file operation in the web application. UploadForm.jsp
is the form,
and UploadAction.jsp is the form processing. The web server is
Websphere.
//UploadForm.jsp
<FORM...
| |
by: HKSHK |
last post by:
This list compares the error codes used in VB.NET 2003 with those used
in VB6.
Error Codes:
============
3: This Error number is obsolete and no longer used. (Formerly:
Return without GoSub)...
|
by: Jean Pierre Daviau |
last post by:
When I have something like this in a js file.
listeImg = new Array();
listeImg = new Image(w,h);
listeImg.src = "centre1.jpg";
etc
Are the images loaded after the page is loaded? In the same...
|
by: tridirk |
last post by:
Hi; I am getting a Objceted Expected Error on my forum site. I can't find what is wrong?
Line:
Char:
Error: Object expected
Code:0
the site is My SMF Forum
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |