PDA

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



JimmyMac
03-30-2006, 07:19 PM
http://home.cfl.rr.com/mcguigs/

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.

Thanks.

thompa
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!

Allan

jscheuer1
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>

or


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

Just a hunch, try setting:


this.setPrintable(true);

to:


this.setPrintable(false);

in wz_jsgraphics.js and see if that fixes it.

On a completely different note, my editor says this:

p.add("Male",2);

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.

djr33
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.

jscheuer1
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:

pieCanvas

They come in pairs, ex:


<TR>
<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>

<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.add("55+",1);
p.render("pieCanvas", "Pie Graph")
</script>
</TD>
</TR>

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


<TR>
<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>

<script type="text/javascript">
var p = new pie();
p.add("Male",2);
p.add("Female",3);
p.render("pieCanvas2", "Pie Graph")
</script>
</TD>
</TR>

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.

JimmyMac
03-31-2006, 01:05 PM
John,

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.

Twey
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.

JimmyMac
03-31-2006, 02:12 PM
Twey,

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.

:D

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


style="bold"

and many of:


style=bold

All of these should be:


style="font-weight:bold;"

djr33
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.

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

djr33
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 :)