473,387 Members | 1,502 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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="JavaScript">
<!--
graph3.makeGraph();
//-->
</script>
</div>

What I would like to do is from another javascript function

document.getElementById('div1').innerHTML = graph3.makeGraph();

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

Thanks.

Kevin
Oct 4 '08 #1
1 2852
KDawg44 <KD*****@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="JavaScript">
<!--
graph3.makeGraph();
//-->
</script>
</div>

What I would like to do is from another javascript function

document.getElementById('div1').innerHTML = graph3.makeGraph();

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.makeGraph() 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/
Oct 4 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Phil N | last post by:
Hello again Site I'm working on: http://www3.telus.net/bikim/lightning/test/ - 'coach' & 'main' links swap innerHTML of div element - id 'textArea' works fine in NN7; IE6 reports 'Object...
1
by: Paul | last post by:
Here is my current code: ------------ <script runat=Server> void Page_Load(object sender, EventArgs e){ if (!IsPostBack){ myDiv.InnerHtml = "Original Content"; } //On Postback, should equal...
4
by: L Anthony Johnson | last post by:
Has anyone had any success doing this. I have tried, but the InnerHTML property always comes back as an empty string. L Anthony Johnson
16
by: Joel Byrd | last post by:
I am having this ridiculous problem of trying to set the innerHTML of a div node. It works in all other browsers, but internet explorer is giving me an "Unknown runtime error". This is actually...
38
by: Luke Matuszewski | last post by:
Welcome I have read the in the faq from jibbering about the generic DynWrite, but i also realized that is uses only innerHTML feature of HTML objects. (1) Is there a DOM function which is very...
1
by: huzheng001 | last post by:
I have develop a on-line dictionary website, http://www.stardict.org I meet a problem: Here is two lines of js codes: document.getElementById("wordlist").innerHTML = "";...
3
by: BeginnerHyun | last post by:
A question on "innerHTML". Hi, The below is my HTML code. ActiveX function "GetData()" returns HTML string which may include javascript codes. This HTML string may be HTML codes in any pages...
2
by: nwaseem | last post by:
Hi everyone, I'm trying to figure out a way to some how 'bind an event' to the innerHTML property. As an example, if I do something like: <containerElement>.innerHTML='some HTML code'; I...
6
by: cantrell78 | last post by:
I can't for the life of me figure out how to execute javascript inside of div that was set using innerHTML or in my case using cloneNode and replaceChild (not my idea to do this, I'm just fixing...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.