Click here to Skip to main content
15,908,172 members
Home / Discussions / JavaScript
   

JavaScript

 
GeneralRe: Why SetTimeout doesn't work inside object? Pin
Olli Ikonen2-May-11 13:56
Olli Ikonen2-May-11 13:56 
Question[RESOLVED] Preserve the form status Pin
CodingLover1-May-11 20:28
CodingLover1-May-11 20:28 
AnswerRe: Preserve the form status Pin
Sunasara Imdadhusen5-May-11 3:55
professionalSunasara Imdadhusen5-May-11 3:55 
GeneralRe: Preserve the form status Pin
CodingLover5-May-11 17:58
CodingLover5-May-11 17:58 
QuestionHow can i refresh status bar information... Pin
Olli Ikonen29-Apr-11 23:42
Olli Ikonen29-Apr-11 23:42 
AnswerRe: How can i refresh status bar information... Pin
DaveAuld29-Apr-11 23:59
professionalDaveAuld29-Apr-11 23:59 
GeneralRe: How can i refresh status bar information... Pin
Olli Ikonen30-Apr-11 0:31
Olli Ikonen30-Apr-11 0:31 
GeneralRe: How can i refresh status bar information... Pin
DaveAuld30-Apr-11 0:33
professionalDaveAuld30-Apr-11 0:33 
GeneralRe: How can i refresh status bar information... Pin
Olli Ikonen30-Apr-11 1:37
Olli Ikonen30-Apr-11 1:37 
GeneralRe: How can i refresh status bar information... Pin
Luc Pattyn30-Apr-11 2:26
sitebuilderLuc Pattyn30-Apr-11 2:26 
GeneralRe: How can i refresh status bar information... Pin
DaveAuld30-Apr-11 4:05
professionalDaveAuld30-Apr-11 4:05 
GeneralRe: How can i refresh status bar information... Pin
Luc Pattyn30-Apr-11 4:48
sitebuilderLuc Pattyn30-Apr-11 4:48 
GeneralRe: How can i refresh status bar information... Pin
DaveAuld30-Apr-11 4:51
professionalDaveAuld30-Apr-11 4:51 
GeneralRe: How can i refresh status bar information... Pin
DaveAuld30-Apr-11 6:35
professionalDaveAuld30-Apr-11 6:35 
GeneralRe: How can i refresh status bar information... Pin
DaveAuld30-Apr-11 5:32
professionalDaveAuld30-Apr-11 5:32 
QuestionWhat in a world i'm doing wrong... Pin
Olli Ikonen30-Apr-11 6:47
Olli Ikonen30-Apr-11 6:47 
AnswerRe: What in a world i'm doing wrong... Pin
Luc Pattyn30-Apr-11 6:52
sitebuilderLuc Pattyn30-Apr-11 6:52 
NewsSorry Pin
Olli Ikonen30-Apr-11 10:01
Olli Ikonen30-Apr-11 10:01 
GeneralRe: What in a world i'm doing wrong... Pin
DaveAuld30-Apr-11 19:58
professionalDaveAuld30-Apr-11 19:58 
AnswerRe: What in a world i'm doing wrong... Pin
Luc Pattyn30-Apr-11 21:27
sitebuilderLuc Pattyn30-Apr-11 21:27 
AnswerDuplicate - Your question also in Q/A section Pin
thatraja30-Apr-11 7:04
professionalthatraja30-Apr-11 7:04 
GeneralRe: How can i refresh status bar information... Pin
thatraja30-Apr-11 8:22
professionalthatraja30-Apr-11 8:22 
NewsSorry Pin
Olli Ikonen30-Apr-11 10:01
Olli Ikonen30-Apr-11 10:01 
Question[RESOLVED] innerHTML messed up Pin
CodingLover27-Apr-11 18:58
CodingLover27-Apr-11 18:58 
AnswerRe: innerHTML messed up Pin
AspDotNetDev27-Apr-11 19:43
protectorAspDotNetDev27-Apr-11 19:43 
Can you provide an example that doesn't work in IE? Until then, here are some general guidelines:

Use "innerHTML", not "innerHtml".

Use createElement, set its innerHTML, then add it to the DOM, rather than adding the element to the DOM then setting the innerHTML. So, do this:
JavaScript
// Create replacement DIV.
var newDiv = document.createElement("div");
newDiv.innerHTML = "Hello, <b>World</b>.";


// Insert replacement DIV.
var oldDiv = document.getElementById("myDiv");
oldDiv.parentNode.insertBefore(newDiv, oldDiv);


// Remove old DIV.
oldDiv.parentNode.removeChild(oldDiv);


// Give replacement DIV same ID as old DIV.
newDiv.id = "myDiv";

Alternatively, avoid the use of innerHTML completely:
JavaScript
// Get DIV.
var mainDiv = document.getElementById("myDiv");


/* TODO: You may want to empty the children here. */
    

// Append "Hello, ".
mainDiv.appendChild(document.createTextNode("Hello, "));


// Append "<b>Hello</b>".
var boldWorld = document.createElement("b");
boldWorld.appendChild(document.createTextNode("World"));
mainDiv.appendChild(boldWorld);


// Append ".".
mainDiv.appendChild(document.createTextNode("."));

Here is a hack that may or may not work:
JavaScript
// Get DIV.
var mainDiv = document.getElementById("myDiv");


// Set innerHTML.
mainDiv.innerHTML = "Hello <b>World</b>.";


// Set innerHTML again (IE hack).
mainDiv.innerHTML = mainDiv.innerHTML;

Depending on your specific issue, I've also seen hacks that modify the z-index so the browser knows to refresh the content.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.