Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] innerHTML problem


  • From: mail.pmpa at sapo.pt (pedro mpa)
  • Subject: [Javascript] innerHTML problem
  • Date: Mon Oct 9 14:08:09 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.