Colin Graham wrote:
I am working with a piece of javascript that i have inherited from
another developer. It is for a date picker function and it runs fine
locally but i get an error when i deploy it on the server and run it.
Can anyone help me with my issue i get a permission denied error also
when the error begins.
i get the error on the folowing part of the codee:
window.opener.Form1.txtDate.value = '05/10/2004'
The complete line of code is
<script language="javascript">window.opener.Form1.txtDate. value =
'05/10/2004';window.close();
You can't set the value of a form element in another window. The solution
to this is to create a function in the opener that does the setting, then
invoke that from the opened window:
-- in the opener --
<script type="text/javascript">
function setFormValue(formName, elementName, value) {
document.forms[formName].elements[elementName].value = value;
}
</script>
-- in the opened window --
<script type="text/javascript">
opener.setFormValue('Form1', 'txtDate', '05/10/2004');
window.close();
</script>
--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ -
http://jibbering.com/faq