View Full Version : Need a little help with javascript and display

03-30-2006, 07:19 PM

Opens fine in FF, but IE blows up on second pie chart. I can't for the life of find the problem or understand microsoft's error message.

Line 84
char 2
Object doen't support this method or property
Code 0

Here is line 84: <TD width="12%" align="center">3</TD>

Can someone take a look at it.


03-30-2006, 09:42 PM
I know it doesn't help... but it works fine in Firefox... if a little long to download on my computer - even on broadband!


03-30-2006, 10:49 PM
That line looks OK. The IE script error report sometimes refers to the previous line and also sometimes to a line in an external file, like:

<script type="text/javascript" src="wz_jsgraphics.js"></script>


<script type="text/javascript" src="pie.js">

Just a hunch, try setting:




in wz_jsgraphics.js and see if that fixes it.

On a completely different note, my editor says this:


is line 84.

And in another vein, these:

<script type="text/javascript" src="wz_jsgraphics.js"></script>
<script type="text/javascript" src="pie.js">

should only appear once on the page, in the head of the page.

03-31-2006, 05:45 AM
Ew. That just crashed my browser. I'm getting a really weird error.... I see all of the tables fine, but all of the pie charts and text are layed on top of each other in the first table.... I'd post a screencap, but, as I said, it crashed my browser, so I don't feel like doing that again. I can get one if you really need it though.
Btw, I'm in safari... the mac browser. It's somewhat based on firefox.

03-31-2006, 08:37 AM
OK, I've looked into the page a bit more. First off, you do need to get rid of all these calls (26 of them, I think):

<script type="text/javascript" src="js/wz_jsgraphics.js"></script>
<script type="text/javascript" src="js/pie.js">

You can keep this one, the one at the top of the page:

<script type="text/javascript" src="wz_jsgraphics.js"></script>
<script type="text/javascript" src="pie.js">

Notice that it doesn't have the js/ in it. Keep it that way.

Next, find every instance of:


They come in pairs, ex:

<TD width="24%" align="left">Under 18</TD>
<TD width="12%" align="center">3</TD>
<TD width="12%" align="right">37.50%</TD>
<TD width="50%" rowspan="8"><div id="pieCanvas" style="position:relative;height:250px;width:250px;"></div>
<script type="text/javascript" src="http://home.cfl.rr.com/mcguigs/wz_jsgraphics.js"></script>
<script type="text/javascript" src="http://home.cfl.rr.com/mcguigs/pie.js">

<script type="text/javascript">
var p = new pie();
p.add("Under 18",3);
p.add("18 - 24",1);
p.add("25 - 34",0);
p.add("35 - 44",0);
p.add("45 - 54",3);
p.render("pieCanvas", "Pie Graph")

Each pair must be unique. You can leave the first pair 'as is' but the next one should look like so:

<TD width="24%" align="left">Male</TD>
<TD width="12%" align="center">2</TD>
<TD width="12%" align="right">40.00%</TD>
<TD width="50%" rowspan="4"><div id="pieCanvas2" style="position:relative;height:250px;width:250px;"></div>


<script type="text/javascript">
var p = new pie();
p.render("pieCanvas2", "Pie Graph")

The next pair can be pieCanvas3, the next pair 4 and so on. Each pair must be unique for IE. There are, I think, 27 pairs in all.

Once that is taken care of, there may be some problems with the actual appearance of the pies but, at least they will all get rendered.

03-31-2006, 01:05 PM

Thanks for spotting that, the page is generated from Java code, so I added a counter to the pie canvas lines and it worked great.

Why does IE not accept javascript in a subfolder? src=js/pie.js returns "pie is undefined" but FireFox has no problem with it?

Thanks again.

03-31-2006, 01:08 PM
I'm in safari... the mac browser. It's somewhat based on firefox.No, it isn't. It has nothing to do with Firefox. It uses the KHTML KDE component, or a variation on it. As such, it's closest to Konqueror.

Why does IE not accept javascript in a subfolder? src=js/pie.js returns "pie is undefined" but FireFox has no problem with it?http://home.cfl.rr.com/mcguigs/js/pie.js doesn't exist. Firefox uses the correctly-defined script John instructed you to leave in the page. IE probably should too.

03-31-2006, 02:12 PM

I figured it out, windows kept capitalzing the js folder and the reference in the code was js not JS, changed it to src and it works now.

Once again, thanks for all the help and tips.


03-31-2006, 03:06 PM
One last thing (hopefully), while we are on this page, I noticed many, many instances of:


and many of:


All of these should be:


03-31-2006, 09:04 PM
Sorry 'bout the safari comment... I thought it was based on firefox... I think someone told me that... anyway... yeah.
glad to see its working out.

03-31-2006, 09:22 PM
Camino (http://www.caminobrowser.org/) is the Mozilla-based browser for Mac.

03-31-2006, 10:08 PM
Alright. Yeah, as I said, someone told me that. I wasn't sure when I posted it, so I should've made a note :)