I keep getting an "undefined" error when I try to pass a asp variable into javascript. What am I doing wrong?
Printable View
I keep getting an "undefined" error when I try to pass a asp variable into javascript. What am I doing wrong?
post ur code..
<%
exportfile = ExportFileName
%>
<SCRIPT LANGUAGE=javascript>
<!--
window.open('http://www.mywebpage.com/' + <%=exportfile%>, 'DatabaseActivity', 'resizable,scrollbars,toolbar')
-->
</SCRIPT>
window.open('http://www.mywebpage.com/<%=exportfile%>', 'DatabaseActivity', 'resizable,scrollbars,toolbar')
that should do it
<%
exportfile = 10
%>
<SCRIPT LANGUAGE=javascript>
<!--
alert('http://www.mywebpage.com/' + <%= exportfile %>);
window.open('http://www.mywebpage.com/' + <%=exportfile%>, 'DatabaseActivity',
'resizable,scrollbars,toolbar')
-->
</SCRIPT>
i hav checked with abv code and its wrking for me .. from where r u getting ur 'ExportFileName '
That works b/c it like sayingQuote:
Originally posted by Kunchesm
<%
exportfile = 10
alert('http://www.mywebpage.com/' + <%= exportfile %>);
alert("hello" + 10);
which is fine but
window.open("http://www.mywebpage.com/"+10)
would not b/c the 10 is outside of the quotes
i hav given alert just for double cheking!! ..
the webpage also opened with the required address .. but with HTTP 404 page cannot be found!
Thanks. I got it to work. This is what I used:
window.open('http://209.113.245.58/Upload/Temp/<%=exportfile%>', 'DatabaseActivity', 'resizable,scrollbars,toolbar,location')
Is there any way to tell when a popup window gets closed?
window.onUnload = alert("close"); will tell you when a window closes.
Kunchesm, I am sorry you are right, I did not know. But why did my solution correct the problem then if there was no problem?
Where do I put that code? I am opening a pdf file in a new window and I want to know when the user closes that window so I can execute some more code.