K
Kiyomi
Hello,
I am trying to replace my alert message box with a popup page.
In my page behind,
Response.Write("<script> alert('" & MyMsg & "') </script>")
is working fine.
I created a javascript function DoDialog() in the HTML part of the same page
and tried to run it with
Response.Write("<script language='javascript'> doDialog() </script>")
Then I get Object Expected error. This code and the function are both on
the same page, and the name of the function is spelled out correctly. I
tried to put my function in an external file .js but the result was the same
(Object Expected).
On the other hand, when I call the same function within HTML page with
onclick="doDialog()", it works fine. If I call it from code behind page
using Button.Attributes.Add("onclick", "doDialog()") it works fine too.
Why this function cannot be recognised in Response.write? In fact, I cannot
use "onclick" to call this function because I have some complex checks to do
on the code behind page (using select case, different stored procedures,
etc.) after clicking the button and before running this function.
I am trying to replace my alert message box with a popup page.
In my page behind,
Response.Write("<script> alert('" & MyMsg & "') </script>")
is working fine.
I created a javascript function DoDialog() in the HTML part of the same page
and tried to run it with
Response.Write("<script language='javascript'> doDialog() </script>")
Then I get Object Expected error. This code and the function are both on
the same page, and the name of the function is spelled out correctly. I
tried to put my function in an external file .js but the result was the same
(Object Expected).
On the other hand, when I call the same function within HTML page with
onclick="doDialog()", it works fine. If I call it from code behind page
using Button.Attributes.Add("onclick", "doDialog()") it works fine too.
Why this function cannot be recognised in Response.write? In fact, I cannot
use "onclick" to call this function because I have some complex checks to do
on the code behind page (using select case, different stored procedures,
etc.) after clicking the button and before running this function.