I have the following code working fine with Win 2003 & IIS 6:
javascript:window.opener.document.formConfirmation.textBoxDateFrom.value = '01/01/2011';
However it does not work with Win 2008 with IIS 7!
I cannot change the code above since the logic is populated from a calendar DLL that I have no access to. I would like to know if it is a setting in IIS that restricts some of the Javascript on working. And if so, what can I do to make the code above work like before.
FYI, the following does NOT work in IIS 7:
document.Form1.txtAlias.value;
but this statement WORKS in IIS 7:
document.getElementById('txtAlias').value;
while BOTH work with IIS 6 !!! What is that about? Any help will help me regain some of my hours waste开发者_如何学JAVAd on this...
This is because you have hard code the control names, but this names are probably dynamic render by asp.net. I say probably because you can setup them to not dynamic change the name on render.
Change your control id with <%=Control.ClientID%> or use some other method to get the values of your controls.
For example.
document.getElementById('<%=txtAlias.ClientID%>').value
or
javascript:window.opener.document.<%=Form.ClientID%>.<%=textBoxDate.ClientID%>.value = '01/01/2011';
In this part of your code document.Form1.txtAlias.value;
, probably the Form1
has change name and not the txtAlias.
Other posible solution if you use asp.net version 4, is to use static id names on your controls.
a tip, on your pages, on your web browser, make right click | view source code to see how your control renders (what id they get).
精彩评论