Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] innerHTML problem
- From: java.script at cutterscrossing.com (Cutter (JSRelated))
- Subject: [Javascript] innerHTML problem
- Date: Mon Oct 9 14:33:14 2006
In my experience, the element must contain something before you are able to replace it's contents with innerHTML. This may not be true for all browsers, but I have found that if I have at least a non-breaking space ( ) in the contents of the div to begin with then I generally never have an issue in any browser on any platform. Anyone else seen similar? Cutter ____________________ http://blog.cutterscrossing.com pedro mpa wrote: > Hi! > > I'm trying to change the innerHTML of a div for a date time picker using > javascript. > > [...] > <div id="datetimepicker"></div> > > <script id="dyn_js_element" src="" language="javascript" > type="text/javascript"></script> > > <script language="javascript" type="text/javascript"> > function DynamicScriptSrc(script_src_url) { > document.getElementById("dyn_js_element").src=script_src_url; > //(1) alert(); > } > > // first call: > DynamicScriptSrc('datetimepicker.61009.php'); > </script> > [...] > > // The php script returns js code for dyn_js_element (exmaple): > document.getElementById('datetimepicker').innerHTML = > '<?=str_replace("\t","", str_replace("\r\n","",$content))?>'; > > The problem is the innerHTML of the div datetimepicker only gets updated if > I add an alert(); (1) to the DynamicScriptSrc function, although it works on > the first call. Why? Is there a workaround? :) > > Does an innerHTML cross-browser function/property exists? > > Apologies for my bad English. > > Thanks in advance. > Pedro.
- Follow-Ups:
- [Javascript] innerHTML problem
- From: pedro mpa
- [Javascript] innerHTML problem
- References:
- [Javascript] innerHTML problem
- From: pedro mpa
- [Javascript] innerHTML problem
- Prev by Date: [Javascript] innerHTML problem
- Next by Date: [Javascript] DIV visibility
- Previous by thread: [Javascript] innerHTML problem
- Next by thread: [Javascript] innerHTML problem
- Index(es):