Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Need a little help with javascript and display

  1. #1
    Join Date
    Mar 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need a little help with javascript and display

    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.

  2. #2
    Join Date
    Mar 2006
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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:

    HTML Code:
    <script type="text/javascript" src="wz_jsgraphics.js"></script>
    or

    HTML Code:
    <script type="text/javascript" src="pie.js">
    Just a hunch, try setting:

    Code:
    	this.setPrintable(true);
    to:

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

    HTML Code:
    <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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    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.

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

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

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

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

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

    Code:
        <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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Mar 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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.

  7. #7
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    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.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  8. #8
    Join Date
    Mar 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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.


  9. #9
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    One last thing (hopefully), while we are on this page, I noticed many, many instances of:

    HTML Code:
    style="bold"
    and many of:

    HTML Code:
    style=bold
    All of these should be:

    HTML Code:
    style="font-weight:bold;"
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  10. #10
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •