[Javascript] innerHTML problem
pedro mpa
mail.pmpa at sapo.pt
Mon Oct 9 14:01:06 CDT 2006
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.
More information about the Javascript
mailing list