Response.Write("<script language =javascript>confirm('成功选择日期')<script>");

Response.Write("<script language =javascript>confirm('成功选择日期')<script>");,第1张

confirm函数是在客户端运行的,而你现在的代码是在服务端运行,不能获取confirm返回值

你可以这样实现:

1先写出页面,不需做获取:

ResponseWrite("<script language =javascript>var i=confirm('成功选择日期');location='xxxxxaspi='+i;</script>");

这里的xxxxxasp就是你接受i值的网址;

2在xxxxxasp里面用request("i")来获取i值。

呵呵,可不可以创建一个全局变量,比如A,先将confirm的返回值保存到临时变量(这是个局部变量,如TMP)中,在获取到confirm的值后,先将这个值赋给那个全局变量,如果需要的话可以先不忙返回值,先进行一些其他处理,在返回confirm的值。不晓得这个样子可否?如:

JScript code

// 先创建一个全局变量

var A = null;

function ResetPassword() {

return PageMethodsGetPassword(Password_CallBack);

}

function Password_CallBack(response) {

documentgetElementById('hiddenPassword')value = response;

// 先别急着返回

var tmp = confirm('The password has been reset to ' + response + ' , do you want to send email');

// 将返回结果赋值给全局变量

// 赋值给全局变量主要是考虑在当前函数外还要使用返回值的情况

A = tmp;

// 如果需要做一些其他的是的话,可以在这里执行,比如通过if语句判断是否需要执行等

if(A == true)

{

// 可以在这里干点事了

}

// 事情干完后就可以返回了

return tmp;

}

sbAppend("{ $('#<%=hdfValueClientID%>')attr('value', '1');}");

你在开玩笑吗?!!

你把aspnet的表达式输出到前端能认吗?!

首先:

<%=hdfValueClientID%>

这个东西浏览器是不认识的,所从aspnet会在动态编译的时候把它变成真正的值,然后再和其它html一起输出到前端。而这部分是aspnet自动为你做了。

如果你自己想把什么东西手动输出到前端的话,你就要自己做那类似动态编译的事,也就是说你只能把动态编译好的结果输出到前端。

所从这里不能用aspnet表达式,只能是字符串。。。

sbAppend("{ $('#“ + hdfValueClientID + "')attr('value', '1');}");

<template>

  <div class="confirm">

    <div class="shade"></div>

    <div class="content">

      <div class="top">提示</div>

      <div class="center">{{title}}</div>

      <div class="bottom">

        <button v-on:click="clickBtn(true)">确定</button>

        <button v-on:click="clickBtn(false)">取消</button>

      </div>

    </div>

  </div>

</template>

<script>

// import Vue from 'vue'

  export default {

    name:'confirmCmp',

    props:['title'],

    data() {return {

    }},

    methods:{

        clickBtn(b){

          thisclose();

          //监听result变化,并发出通知(在angularjs中叫做广播,angularjs提供了emit,broadcast和$on服务用于向子父中传递消息)

          this$emit('result', b);

        },

        open(){

          documentquerySelector('confirm')styledisplay='block'

        },

        close(){

          documentquerySelector('confirm')styledisplay='none'

        }

    },

    mounted() {

        //垂直居中

        var windowHeight=windowinnerHeight;

        var domObj=documentquerySelector('content');

        var domObjHeight=domObjoffsetHeight;

        //consolelog(domObjHeight)不知道为啥获取不到高

        var top=windowHeight/2-77;

        domObjstyletop=top+'px';

    },

    install(Vue){ //核心部分,在我们使用Vueuse()时,自动调用的是install,而install导出的必须是的组件

//        consolelog('confirmCmpInstall');

 Vuecomponent('confirmCmp',this);

 }

  }

</script>

<style>

      confirm{display:none;

         position:fixed; z-index:1;width: 100%;

         height: 100%;

     }

      shade{

          position:fixed;

          z-index: 2;

          background-color: rgb(0, 0, 0);

          opacity: 03;

          width: 100%;

          height: 100%;

      }

      content{

        background-color: white;

        z-index: 3;

        width: 260px;

        margin: auto;

        position: relative;

        left: 0; right: 0;

      }

    top{

      padding-left: 20px;

      background: #f6f6f6;

      /color: #212a31;/

      font-size: 16px;

      font-weight: 700;

      height: 46px;

      line-height: 46px;

      border-bottom: 1px solid #D5D5D5;

    }

    center{

      padding: 20px;

      line-height: 20px;

      font-size: 14px;

    }

    bottom{

      border-top: 1px solid #D5D5D5;

      text-align:center;

      height: 46px;

      line-height: 46px;

      background: #f6f6f6;}

    bottom button{width: 60px; border: none; height: 30px; display: inline-block; }

    bottom button:first-child{background-color:#1E9FFF;color: white;margin-right: 3px}

    bottom button:last-child{margin-left: 3px}

</style>

<!-- 插件开发教程 -->

<!-- >

以上就是关于Response.Write("<script language =javascript>confirm('成功选择日期')</script>");全部的内容,包括:Response.Write("<script language =javascript>confirm('成功选择日期')</script>");、请问Ajax如何获取回调函数的返回值、c# 后台脚本注册confirm框 确定后给隐藏域赋值 获取不到 始终是空的 我打断点 是代码跑完了 还没赋值 求解等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/10058354.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-04
下一篇2023-05-04

发表评论

登录后才能评论

评论列表(0条)

    保存