innerhtml

Compare text with innerHTML IE7 problem

I can't find a work around for the innerHTML bug in IE7. I need to look at the contents of dynamicly generated HTML and change it if the text is "-1". I'm using the prototype js gallery but couldn't find a fix. Any ideas? JS: <script language="javascript" type="text/javascript"> Event.observe(window, 'load', function () { var num ...

shrink html help

I have an array of 2000 items, that I need to display in html - each of the items is placed into a div. Now each of the items can have 6 links to click on for further action. Here is how a single item currently looks: <div class='b'> <div class='r'> <span id='l1' onclick='doSomething(itemId, linkId);'>1</span> <span id='l2' on...

ie7 innerhtml strange display problem

Hello, I am having a strange problem with ie7 (ie8 in compatibility mode). I have div containers where I am updating values using javascript innhtml to update the values. This works fine in Firefox and ie8. In ie7 the values do not update but if a click on the values and highlight them then they update, also if a change the height of the...

How can I get value from radio-button inserted into innerHtml

I have sort of a table with a radio-button column. I managed to make radio-button column work dynamically inserting into a cell (div if matter). But, on postback innerHtml hasn't been updated with "checked" attribute. Could you give me an idea how can I find out (on the server) if radio-button has been checked? More info: This is on...

How do I force the browser to render the tags rather than reveal them to the user on altered div:innerHTML?

I'm allowing the user to select text contained within <div></div> and change it to bolded text. In other words from <div>this is some text</div> to <div>this is <b>some</b> text</div>. All is working except that when I change the div.innerHTML to this is <b>some</b> text, the <b>some</b> tags are shown to the user rather than being rend...

innerHTML working in FF but not in IE!

In my JSP i am using a custom tag <showDateFormat/> like: Date From:<showDateFormat/> and in my common.js file i am having function addDateFormatInfo(){ var dateFormatHolder = document.getElementsByTagName("showDateFormat"); if ( dateFormatHolder ){ for ( i = 0 ; i < dateFormatHolder.length; i++ ){ dateFormatH...

How to add dynamic html content to a servlet at run time?

I've an HTML text which i want to display on servlet. This servlet already has some text fields, forms etc. Whenever I try to add this HTML text, servlet get distorted. I used IFrame to populate the HTML text but :-(. Please suggest how I can do this? ...

innerHTML size limit

I want to use AJAX to load an htmlfile into a <div> I will then need to run jsMath on this. Everything I have done so far with innerHTML has been a paragraph or two, maybe a table and/or image. Nothing too fancy. What potential problems may occur when I set innerHTML to an external 25k file, with all sorts of complex css formatting?...

Javascript search for tag and get it's innerHTML

Hello, It's probably something really simple, but I'm just learning. There's a page with 3 blockquote tags on it, and I'd need to get the innerHTML of the one containing a certain string. I don't know how to search/match a string and get the innerHTML of the tag containing the matched result. Any help would be appreciated for this new...

IE7 glitch with appendChild() for an input box

I am using the following JavaScript to add a number of inputs based on a number in a drop down menu. It works fine in firefox and chrome, but in IE7 the inputs all float left on a new line. function add(number) { var foo = document.getElementById("listInputs2"); var count = 1; foo.innerHTML = ""; while ( count <= (number) ) { //Creat...

innerHTML side effects?

I'm having some issues with a DOM element reference and I think I've tracked it down to having something to do with updating innerHTML. In this example, at the first alert, the two variables refer to the same element, as expected. What's strange though is that after updating the innerHTML of the parent element (body), the two variables ...

innerHTML alternative for retrieving contents of page?

I'm currently using innerHTML to retrieve the contents of an HTML element and I've discovered that in some browsers it doesn't return exactly what is in the source. For example, using innerHTML in Firefox on the following line: <div id="test"><strong>Bold text</strong></strong></div> Will return: <strong>Bold text</strong> In IE,...

Dynamic equivalent of innerHTML?

Hi I want to get the innerHTML of an element that may have been changed by the user. So, for example, I want to know the state of a radio button: <input type="radio" name="Q_209" value="A" checked> or <input type="radio" name="Q_209" value="A"> In modern browsers, innerHTML just gives the original tag when the page was loaded (a...

innerHTML causes IE6 to (permanantly) lock up

On a site I am working on I load up a series of images which can be animated using some controls I implemented w/javascript. Everything works just fine in all browsers but IE6 which locks up and never recovers; at least not w/in the 15min I let it sit there. The part it is choking on is a portion where I try to modified the contents of...

Is there some code that can be used to locate an element and the offset by its parent's object and a text index?

I mean, take the following HTML codes as example, ignore the whitespaces. <p> paragraph-text <span> span text <i>it</i> </span> </p> I have the pNode object and the index of "a" in "span text" within pNode.innerHTML as a whole, that is 23 here since pNode.innerHTML="paragraph-text<span>span text<i>it</i></span>", the open...

Question using Ext's update() instead of dom.innerHTML

I have a question concerning the performance, reliability, and best practice method of using Extjs's update() method, versus directly updating the innerHTML of the dom of an Ext element. Consider the two statements: Ext.fly('element-id').dom.innerHTML = 'Welcome, Dude!'; and Ext.fly('element.id').update('Welcome, Dude!', false); I...

iframe problem using javascript

Does anyone know how to get the HTML out of an IFRAME? I have tried several different ways: document.getElementById('iframe01').contentDocument.body.innerHTML, document.frames['iframe01'].document.body.innerHTML, document.getElementById('iframe01').contentWindow.document.body.innerHTML, etc but none of them worked. I believe the reaso...

Is there a way to transform a string from JSON into a DOM structure?

The Problem is: I get the following structure (generated in PHP) sent via JSON as a string. <article> <header> <h2><a href="#">url</a></h2> <p><time datetime="2009-11-05">05 Nov 2009</time></p> </header> <div class="entry"> <p>something</p> ... </div> <footer>something</footer> </article> I have a list of arti...

Add to HTML form without losing current form input information in Javascript

I have a drop down which builds a form based of the selections that are selected. So, if someone selects 'foobar', it displays a text field, if they choose 'cheese', it displays radio buttons. The user can then enter data into these forms as they go along. The only problem is that when they add a new form element, all the rest of the inf...

javascript change innerhtml

ok im new at javascript, but im trying to change the innerhtml of a div tag, heres my script and its not working: <head> <script type="text/javascript"> function var1() { document.getElementById('test').innerHTML = 'hi'; } window.onLoad = var1(); </script> </head> <body> <div id="test">change</div> </body> it should work but for some ...