zoukankan      html  css  js  c++  java
  • asp.net服务器端执行javascript代码

    点击提交按钮,确认是否已经登陆,如果没有登陆弹出登陆窗口,如果已经登陆,直接提交评论.

    if (!object.Equals(null, Session["userInfo"]))
            {
                this.btnSubmit.Visible = true;
                this.btnOpen.Visible = false;
            }
            else
            {
                this.btnSubmit.Visible = false;
                this.btnOpen.Visible = true;
                this.btnOpen.Attributes.Add("onclick", "OpenWin()");
            }

            //打开模态窗体
            string strscript = "\n";
            if (!Page.IsClientScriptBlockRegistered("clientscript"))
            {
                strscript = "<script>\n";
                strscript += "function OpenWin(){\n";
                strscript += "var strlist=new Array(2);var width=(window.screen.width - 403) / 2;var height=(window.screen.height - 258) / 2; var str=window.showModalDialog('http://register.staging.ha.edu.cn/LoginPanel.aspx','','dialogLeft:' + width + 'px;dialogTop:' + height + 'px;dialogWidth=403px;dialogHeight=258px;help:no;location:no;toolbar:no;menubar:no;center:yes;scrollbars:no;z-look :no;alwaysRaised :no;resizable:no;scroll:no;location:no;status:no');\n";
                strscript += "if(str!=null){ }\n";
                strscript += "}\n";
                strscript += "</script>\n";

         ClientScript.RegisterClientScriptBlock(this.GetType(), "clientscript", strscript);
                     }

  • 相关阅读:
    mysql workbench 建表时PK, NN, UQ, BIN, UN, ZF, AI
    Asan检测内存读越界
    C 实现 C++ 的面向对象特性(封装、继承、多态)
    VIBE算法
    Go 大坑 nil
    求二叉树中节点的最大距离
    计算[1,N]范围内含有7的数字的个数
    一组便于创建线程和线程池的简单封装函数
    用C#执行doc命令
    可以自由停靠的窗体!
  • 原文地址:https://www.cnblogs.com/lljinz/p/2002915.html
Copyright © 2011-2022 走看看