JavaScript代码如何调用从asp.net代码JavaScript函数后面功能
function logoutPop() {
var a = confirm("are you sure !");
if (a = true)
return true;
else return false;
}
aspx文件
protected void Menu1_MenuItemClick(object sender, MenuEventArgs e)
{
string selectedItem = e.Item.Value;
if (selectedItem == "logout")
{
// here i want to call javascript function logoutPop() and check return value. if true want to redirect login page else nothing.
有没有办法做到这一点。我尝试了scriptmanager,但没有成功。请帮忙 。谢谢。
的可能重复[参考:为什么PHP(或其他服务器端)在我的javascript代码不行?] (http://stackoverflow.com/questions/13840429/reference-why-does-the-php-or-other-server-side-code-in-my-javascript-not-wor) – Quentin
你是什么样的菜单使用?也许你可以通过在客户端确认并在YES上提高服务器端事件来实现此目的。 – yogi