innerHTML = JavaScript object

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • KDawg44

    innerHTML = JavaScript object

    HI,

    I am using jsgraph to draw some graphs. I want to be able to update
    these graphs by calling a javascript function to update data.

    I have a div to display the graph that looks like this:

    <div id = 'div1'>
    <script language="JavaS cript">
    <!--
    graph3.makeGrap h();
    //-->
    </script>
    </div>

    What I would like to do is from another javascript function

    document.getEle mentById('div1' ).innerHTML = graph3.makeGrap h();

    but this does not work. Is there a way to output a javascript object
    to a div?

    Thanks.

    Kevin
  • Joost Diepenmaat

    #2
    Re: innerHTML = JavaScript object

    KDawg44 <KDawg44@gmail. comwrites:
    HI,
    >
    I am using jsgraph to draw some graphs. I want to be able to update
    these graphs by calling a javascript function to update data.
    >
    I have a div to display the graph that looks like this:
    >
    <div id = 'div1'>
    <script language="JavaS cript">
    <!--
    graph3.makeGrap h();
    //-->
    </script>
    </div>
    >
    What I would like to do is from another javascript function
    >
    document.getEle mentById('div1' ).innerHTML = graph3.makeGrap h();
    >
    but this does not work. Is there a way to output a javascript object
    to a div?
    If you set innerHTML to a string containing a valid HTML snippet, it
    will work. where that string came from is irrelevant.

    I suspect your graph3.makeGrap h() does not return a string, but calls
    document.write( ) instead - which you cannot for this after the document
    has loaded. So change that.

    --
    Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/

    Comment

    Working...