...

View Full Version : html and javascript



brobbs
07-11-2002, 08:24 PM
description of problem

using, windows XP to load an html containing a javascript is the problem.
first , the html page doesn't display all the fields defined in the javascript running on netscape 6,
I have one button in my java code that calls this html page to open. this page contains the javascript file which is suppose to open with the html. but when the button is pressed, the html page is displayed but the javascript doesn't.
is there any work arounds on this problem?

thanks,

Isaac.

Alex Vincent
07-11-2002, 08:38 PM
Source code and/or a link, please. :)

brobbs
07-11-2002, 09:06 PM
Error: app2 has no properties
Source File: file:///C:/brobbwork/MyTest.html
Line: 26

The above is the error that i get when i run the javascript. below :
thanks,
Isaac.


<html>
<head>
<title>Graphics</title>
<applet
code="SqlApplet.class"
codebase="http://localhost:8080/learn/applet/"
height="0"
name="SqlApplet"
width="0">
<param
name="servlet"
value="http://localhost:8080/learn/servlet/SqlServlet" />
</applet>
<applet align=middle code="Vasxe.class" ARCHIVE="visad.jar" width=1080 height=600 name="GraphicDisplay">
</applet>
<script LANGUAGE="JavaScript">
var app1 = document.SqlApplet;
var app2 = document.GraphicDisplay;
function getFields() {
fields = new Array(4);
//var sql = "select P.Locus, P.Mass, P.Pi, NT.Proportion ";
//sql += "from PROTEIN P, EXPERIMENT E, table (E.PropData) NT ";
//sql += "where P.Locus = NT.Locus and P.Mass < 10000";
sql = parent.frames[1].document.controlForm.sqlQuery.value;
app1.execute(sql);
app1.changeRowCount(30);
while (app1.next()) {
var cols = app1.getColumnCount();
for (var j=0; j<cols; j++) {
fields[j] = app1.getString(j);
}
app2.loadProteinVector(fields[0],fields[1],fields[2],fields[3]);
}
//app2.setXAxisLength();
//app2.execute();
}
function DisplayProteinPage() {
parent.frames[1].document.controlForm.pName.value=app2.IIprox();
location.href="LoadProtein.html";
}
</SCRIPT>
</head>
<body onLoad="getFields();" BGCOLOR="lightblue">
<form>
<input
type="button"
name="displayProPageButton"
onclick="DisplayProteinPage()"
value="DisplayProteinPage">
</form>
</body>
</html>

glenngv
07-12-2002, 03:47 AM
see the changes in bold:

<applet
code="SqlApplet.class"
codebase="http://localhost:8080/learn/applet/"
height="0"
name="SqlApplet"
width="0" MAYSCRIPT>
<param
name="servlet"
value="http://localhost:8080/learn/servlet/SqlServlet" />
</applet>
<applet align=middle code="Vasxe.class" ARCHIVE="visad.jar" width=1080 height=600 name="GraphicDisplay" MAYSCRIPT>
</applet>
<script LANGUAGE="JavaScript">
var app1 = document.applets["SqlApplet"];
var app2 = document.applets["GraphicDisplay"];


To enable an applet to access Javascript on your page, you must specify the <APPLET> tag's MAYSCRIPT attribute; failure to do this will cause an exception if the applet tries to access JavaScript. This allows a measure of security for each HTML page that contains the applet.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum