PDA

View Full Version : Getting error while using the javascript to draw the line graph inside the while loop



Gurudev Arer
08-27-2010, 07:44 AM
I am using the javascript to draw the line graph in my application.
i have implemented successfully.
But now i am trying to include the same javascript inside a while loop i am getting

Message: Object doesn't support this property or method
Line: 83
Char: 2
Code: 0
URI: http://localhost:8080/o2a_server/js/wz_jsgraphics.js

on the browser.

Basically i am fetching some objects from the database and i need to draw the graph for each object. So i have included the javascript inside the while loop of the resultset.

Can you please let m eknow what might be the causing this error..

Thanks for your time.

vwphillips
08-27-2010, 09:11 AM
your link is broken

Gurudev Arer
08-27-2010, 09:47 AM
What exactly you mean by link is broken.

Please explain.

Thanks

clueful
08-27-2010, 11:04 AM
What exactly you mean by link is broken.

Please explain.

ThanksWe need to see

http://localhost:8080/o2a_server/js/wz_jsgraphics.js

But that's not an internet URL.

Gurudev Arer
08-27-2010, 11:13 AM
function pntCnvIe()
{
this.cnv.insertAdjacentHTML("BeforeEnd", jg_fast? this.htmRpc() : this.htm);
this.htm = '';
}

Is the part of the code where i am getting the error :
Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; InfoPath.2)
Timestamp: Fri, 27 Aug 2010 11:09:11 UTC


Message: Object doesn't support this property or method
Line: 83
Char: 2
Code: 0
URI: http://localhost:8080/o2a_server/js/wz_jsgraphics.js

You need to login into the system to look at that page.

<TR HEIGHT="99%">
<TD>
<TABLE ALIGN="center" BORDER="0" HEIGHT="100%" WIDTH="100%" CELLPADDING="0" CELLSPACING="0">
<%
Connection connection = null;
Statement statement = null;
ResultSet rs = null;
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection = DriverManager.getConnection(conn_url,username,password);
statement = connection.createStatement();
String QueryString = "select COW_ID,COW_NAME from oxy_cows where cow_id<>1 and MALE_OR_FEMALE ='F'";
rs= statement.executeQuery(QueryString);
while (rs.next())
{
cow_id=rs.getString(1);
cow_name=rs.getString(2); %>
<tr height="9%" valign="middle">
<td align="center">
<center>
<div id="myCanvas" style="overflow: auto; position:fixed;height:300px;width:100%; "></div>
<script>
var g = new line_graph();
var g2 = new line_graph();
var color = 4;
var color1 = 55;
<%
Connection connection1 = null;
Statement statement1 = null;
ResultSet rs1 = null;
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection1 = DriverManager.getConnection(conn_url,username,password);
statement1 = connection1.createStatement();
String QueryString1 =null;
QueryString1 = "select date_format(MILK_DATE,'%d'),MORNING_MILK from oxy_milk_production where COW_NUMBER='"+cow_id+"'and milk_date between '"+doctor_milking_allcow_from_date+"' and '"+doctor_milking_allcow_to_date+"' order by milk_date";
rs1 = statement1.executeQuery(QueryString1);
while (rs1.next())
{ %>
g.add('<%=rs1.getString(1)%>', <%=rs1.getString(2)%>);
<%}
rs1.close();
statement1.close();
connection1.close();
}
catch (Exception ex)
{
%><FONT SIZE="+3" COLOR="green"> <%
out.println("Unable to connect to database.");
statement1.close();
connection1.close();
}
%>

<%
Connection connection2 = null;
Statement statement2 = null;
ResultSet rs2 = null;
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection2 = DriverManager.getConnection(conn_url,username,password);
statement2 = connection2.createStatement();
String QueryString2 =null;
QueryString2 = "select date_format(MILK_DATE,'%d'),EVENING_MILK from oxy_milk_production where COW_NUMBER='"+cow_id+"'and milk_date between '"+doctor_milking_allcow_from_date+"' and '"+doctor_milking_allcow_to_date+"' order by milk_date";
rs2 = statement2.executeQuery(QueryString2);
while (rs2.next())
{ %>
g2.add('', <%=rs2.getString(2)%>);

<%}
rs2.close();
statement2.close();
connection2.close();
}
catch (Exception ex)
{
%><FONT SIZE="+3" COLOR="green"> <%
out.println("Unable to connect to database.");
statement2.close();
connection2.close();
}
%>
g.setMax(10);g.setColor(color);
g2.setMax(10);g2.setColor(3);
g.render("myCanvas", "Blue: Morning, Red: Evening");
g2.render("myCanvas", "");
delete g;
delete g2;
</script>
<FONT color="8A5C2E" SIZE="5" STYLE="font-family: sans-serif ">Milking Graph for <%=cow_name%>. </FONT>
</center>
</td>

</tr>
<%}
rs.close();
statement.close();
connection.close();
%>
</TABLE>
<% }
catch (Exception ex)
{
%> <FONT SIZE="+3" COLOR="green"> <% out.println("ABCSINGLE:Unable to connect to database.");
statement.close();
connection.close();
}
%> </FONT></TD>
</TR>

Is the code where i have used the script.

Thanks

clueful
08-27-2010, 01:22 PM
URI: http://localhost:8080/o2a_server/js/wz_jsgraphics.js

You need to login into the system to look at that page.If you want any help it's you who has to log in to the system, copy the contents of that file to the clipboard, then paste it here.

Gurudev Arer
08-30-2010, 05:17 AM
Hi All,

Error message:

Message: Object doesn't support this property or method
Line: 83
Char: 2
Code: 0
URI: http://www.oxygenacres.com/js/wz_jsgraphics.js

I have uploaded it to the hosting server. Above is the error message what i get at the browser.

Thanks for your time.

clueful
08-30-2010, 01:33 PM
function pntCnvIe()
{
this.cnv.insertAdjacentHTML("BeforeEnd", jg_fast? this.htmRpc() : this.htm);
this.htm = '';
}
The error message seems to indicate the line above. There seem to be IE issues with insertAdjacentHTML, but I'm not getting involved with third-party code.