Tinybox JavaScript提前关闭 [英] Tinybox javascript is closing prematurely

查看:167
本文介绍了Tinybox JavaScript提前关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"

    CodeFile="Default.aspx.cs" Inherits="_Default" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
    <script type="text/javascript">
        function popup() { TINY.box.show({image: 'rhino.jpg', boxid: 'error', animate: true }) }
    </script>
 <script type="text/javascript" src="Scripts/tinybox.js"></script>
   <link rel="stylesheet" href="Styles/style.css" type="text/css" />
  <link rel="stylesheet" href="Styles/Site.css" type="text/css" />
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
  
        <asp:Button ID="testclick" runat="server" Text="Button" />
</p>
    <p>
        <asp:Image ID="Image1" runat="server" ImageUrl="~/rhino.jpg" />

    </p>
</asp:Content>




我在attribute.add("onclick","popup()")
之后放了一个代码 它在起作用
http://webofsteel.org/public_html/Default.aspx [




I put a codebehind attributes.add("onclick", "popup()")
here it is in action
http://webofsteel.org/public_html/Default.aspx[^]

推荐答案

更改
attributes.add("onclick", "popup()")





to

attributes.add("onclick", "popup(); return false;")



返回false;将阻止按钮执行回发并重新加载页面.



return false; will prevent the button from doing the postback and reloading the page.


这篇关于Tinybox JavaScript提前关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆