473,796 Members | 2,640 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Oct 4 '08 #1
1 2870
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="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/
Oct 4 '08 #2

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

Similar topics

5
8453
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 doesn't support this property or method' code is:
1
2062
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 "Original Content and New Content" string strContent = myDiv.InnerHtml; }
4
5142
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
13348
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 in the context of developing an auto-suggest (basically reverse-engineering Google Suggest), but I don't see how any of the other code has anything to do with it. I *pretty sure* that I've narrowed it down to 1 line (the line on which the...
38
3492
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 similar to innerHTML property eg. (my guess) setInnerNodeAsText or sth... ? I want to write function which will be dynamically updateing some of my select boxes. My question is: (2.1) Can i use innerHTML property of SELECT (or even incorporate
1
2199
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 = ""; document.getElementById("definition").innerHTML = "line1<br>line2"; The corresponding html codes are: <table width="100%"> <tr> <td width="25%" valign="top"><div id="wordlist" width="100%" style=' overflow-y:auto; height:352px;'></div></td>
3
1831
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 which I will navigate to. The result of the below code is not what I expected. Error occurred in the line "divEncId.innerHTML=enc;".
2
4200
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 would like somehow to be able to fire an event to accommodate the updated container content. I just spent today and yesterday teaching myself prototypes and literals and all that cool stuff; from what I was able to pick up, I came up with the...
6
2800
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 it). I have tried it with and without the defer attribute. It will work fine in firefox, but not IE. <script type="text/javascript"> function setInnerHTMLAndExecScript (element, html) { var newElement = element.cloneNode(false);...
0
10449
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10217
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10168
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5568
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.