473,732 Members | 1,987 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error on Loading Page from Link

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>Pa tient Data</b><br>Wt: "+weight+"
"+weightUni ts+" &nbsp&nbsp Ht: "+height+"i n &nbsp&nbsp Gender:
"+gender+"<br>< a href=\"index.ht ml\">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="Mozill a/4.7 [en] (Win98; U) [Netscape]">
<title>UMC Out of Range Heparin Protocol</title>
</head><body background="coc tail3.gif" link="#0000DD" vlink="#0000DD"
alink="#0000DD" >
<center><font size=+3>UMC Demo Heparin Protocol</font><font
size=+3></font></center><br>

<script language="JavaS cript">

function calculate()
{
if (document.form. weight.value != "" && document.form.h eight.value !=
"" && document.form.a ge.value != "")
{
//0 is kg
if (document.form. wtUnits[0].checked)
{
weight = document.form.w eight.value;
weightUnits = "kg"
}
else if (document.form. wtUnits[1].checked)
{
weight = document.form.w eight.value / 2.2
weightUnits = "lbs"
}

height = document.form.h eight.value;
age = document.form.a ge.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.d iagnosis[1] ||
document.form.d iagnosis[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><m eta http-equiv=\"Content-Type\"
content=\"text/html; charset=iso-8859-1\"><meta name=\"Andrew V.
Romero\" content=\"romer o\"><title>UM C Out of Range Heparin
Protocol</title></head><body background=\"co ctail3.gif\"
link=\"#0000DD\ " vlink=\"#0000DD \" alink=\"#0000DD \"><center><fon t
size=+3>UMC Demo Heparin Protocol</font><font size=+3></font></center>";
pageData = PageData+"<b>Pa tient Data</b><br>Wt: "+weight+"
"+weightUni ts+" &nbsp&nbsp Ht: "+height+"i n &nbsp&nbsp Gender:
"+gender+"<br>< a href=\"index.ht ml\">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=calcul ate();>
<table border =1>
<tr><td colspan=3><b>Pa tient Data</b></td></tr>
<tr><td><b>Weig ht (kg)</b></td><td><input name="weight" size=5><input
type="radio" name="wtUnits" value="kg" checked>Kg &nbsp&nbsp<inpu t
type="radio" name="wtUnits" value="lb">lbs</td></tr>
<tr><td><b>Heig ht (in)</b></td><td><input name="height" size=3></td></tr>
<tr><td><b>Ag e</b></td><td><input name="age" size=3></td></tr>
<tr><td><b>Gend er</b></td><td><input type="radio" name="gender"
value="male" checked>Male &nbsp&nbsp <input type="radio" name="gender"
value="female"> Female</td></tr>
<tr><td><b>Diag nosis</b> </td><td><input type="radio" name="diagnosis "
value="AMI" checked>AMI &nbsp&nbsp <input type="radio" name="diagnosis "
value="USA">USA &nbsp&nbsp <input type="radio" name="diagnosis "
value="AFib">Af ib &nbsp&nbsp<inpu t type="radio" name="diagnosis "
value="DVTorPE" >DVT or PE</td></tr>
<tr><td><b>Bolu s</b></td><td><input type="radio" name="bolus"
value="yes" checked>Yes &nbsp&nbsp <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>

Jul 20 '05 #1
1 2355
opps, part of my code was wrong when I cut and pasted the line pageData
= PageData+"<b>Pa tient 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>Pa tient Data</b><br>Wt: "+weight+"
"+weightUni ts+" &nbsp&nbsp Ht: "+height+"i n &nbsp&nbsp Gender:
"+gender+"<br>< a href=\"index.ht ml\">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="Mozill a/4.7 [en] (Win98; U) [Netscape]">
<title>UMC Out of Range Heparin Protocol</title>
</head><body background="coc tail3.gif" link="#0000DD" vlink="#0000DD"
alink="#0000DD" >
<center><font size=+3>UMC Demo Heparin Protocol</font><font
size=+3></font></center><br>

<script language="JavaS cript">

function calculate()
{
if (document.form. weight.value != "" && document.form.h eight.value
!= "" && document.form.a ge.value != "")
{
//0 is kg
if (document.form. wtUnits[0].checked)
{
weight = document.form.w eight.value;
weightUnits = "kg"
}
else if (document.form. wtUnits[1].checked)
{
weight = document.form.w eight.value / 2.2
weightUnits = "lbs"
}

height = document.form.h eight.value;
age = document.form.a ge.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.d iagnosis[1] ||
document.form.d iagnosis[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><m eta http-equiv=\"Content-Type\"
content=\"text/html; charset=iso-8859-1\"><meta name=\"Andrew V.
Romero\" content=\"romer o\"><title>UM C Out of Range Heparin
Protocol</title></head><body background=\"co ctail3.gif\"
link=\"#0000DD\ " vlink=\"#0000DD \" alink=\"#0000DD \"><center><fon t
size=+3>UMC Demo Heparin Protocol</font><font size=+3></font></center>";
pageData = PageData+"<b>Pa tient Data</b><br>Wt: "+weight+"
"+weightUni ts+" &nbsp&nbsp Ht: "+height+"i n &nbsp&nbsp Gender:
"+gender+"<br>< a href=\"index.ht ml\">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=calcul ate();>
<table border =1>
<tr><td colspan=3><b>Pa tient Data</b></td></tr>
<tr><td><b>Weig ht (kg)</b></td><td><input name="weight"
size=5><input type="radio" name="wtUnits" value="kg" checked>Kg
&nbsp&nbsp<inpu t type="radio" name="wtUnits" value="lb">lbs</td></tr>
<tr><td><b>Heig ht (in)</b></td><td><input name="height"
size=3></td></tr>
<tr><td><b>Ag e</b></td><td><input name="age" size=3></td></tr>
<tr><td><b>Gend er</b></td><td><input type="radio" name="gender"
value="male" checked>Male &nbsp&nbsp <input type="radio" name="gender"
value="female"> Female</td></tr>
<tr><td><b>Diag nosis</b> </td><td><input type="radio"
name="diagnosis " value="AMI" checked>AMI &nbsp&nbsp <input type="radio"
name="diagnosis " value="USA">USA &nbsp&nbsp <input type="radio"
name="diagnosis " value="AFib">Af ib &nbsp&nbsp<inpu t type="radio"
name="diagnosis " value="DVTorPE" >DVT or PE</td></tr>
<tr><td><b>Bolu s</b></td><td><input type="radio" name="bolus"
value="yes" checked>Yes &nbsp&nbsp <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>


Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5996
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 the function looks like this: BEGIN CODE
3
6087
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 that also hosts a .net object (e.g. by click a hyperlink).
0
1708
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 causes. It seems normal instead that before loading the second page (in third row from last row) there's a text read as:
5
4215
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 ifram to a specific url. Here is the code I'm using: <html> <head>
24
2758
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 NAME="InputForm" ACTION="UploadAction.jsp" METHOD="POST" enctype=multipart/form-data> <input type="file" name="fileName"> //etc ...
0
23503
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) 5: Procedure call or argument is not valid. 6: Overflow. 7: Out of memory.
2
2993
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 time? Before the page is loaded? The browser decision? If the visitors goes, before the procedure is over, to another page having a link to the same js file, will the other page allows for the rest of the
2
31773
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
0
8772
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9443
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9303
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9233
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9177
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8184
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
3258
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2714
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2176
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.