简体   繁体   English

我该如何设置sevenup?

[英]how do I set up sevenup?

I am just trying to get this plugin to work but I am not sure what I am doing wrong. 我只是想让这个插件正常工作,但是我不确定自己做错了什么。

http://code.google.com/p/sevenup/ http://code.google.com/p/sevenup/

So I tried to follow the one like of code they give you. 因此,我尝试遵循他们给您的代码。

<script type="text/javascript" src="sevenup.0.3.min.js"></script>
...
<body onload="sevenUp.test( options, callback );">

My test page. 我的测试页。

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>

    <script src="sevenup.0.3.js" type="text/javascript"></script>

</head>
<body onload="sevenUp.test( options, callback );"> 
    <form id="form1" runat="server">
    <div>

    </div>
    </form>
</body>
</html>

So I did that and I get "option" is not defined. 所以我做到了,我没有定义“选项”。

So I tried this then 所以我尝试了这个

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>

    <script src="sevenup.0.3.js" type="text/javascript">

                var options = {
          enableClosing: true,
          enableQuitBuggingMe: true,
          overlayColor: "#000000",  
          lightboxColor: "#ffffff",
          borderColor: "#6699ff",
          downloadLink: osSupportsUpgrade ? 
                        "http://www.microsoft.com/windows/internet-explorer" :
                        "http://getfirefox.com",
          overrideLightbox: false,
          lightboxHTML: null,
          showToAllBrowsers: false
        };

        var callback = function() {
          // Switch IE-specific content
          // AJAX call to map IP to 'IE6 user' status
          // etc.
        }

sevenup.test(options, callback);
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
    </div>
    </form>
</body>
</html>

but nothing happens. 但什么也没发生。

What am I missing. 我想念什么。

Can someone set me an example up? 有人可以给我一个榜样吗? Like I tried many different ways other then above and I still can't get it to work. 就像我尝试了除上述以外的许多其他方式一样,我仍然无法使它正常工作。

A standard Html page should be fine. 标准的HTML页面应该没问题。 Since this really does not need serverside stuff. 由于这确实不需要服务器端的东西。


Here is a standard html page. 这是标准的html页面。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <title>Untitled Document</title>
        <script type="text/javascript" src="sevenup.0.3.js"></script>
        <script type="text/javascript" src="sevenup_black.0.3.js"></script>

    </head>
    <body onload="sevenUp.plugin.black.test( options, callback );">
    </body>
</html>

So not sure what I am still doing wrong. 所以不确定我仍然在做错什么。 Get options undefined. 获取未定义的选项。

You're using ASP.NET and the Body OnLoad is not a great place for putting JavaScript hooks. 您正在使用ASP.NET,而Body OnLoad并不是放置JavaScript钩子的好地方。

Add this to the very bottom of your page before the </body> tag: 将其添加到页面的底部</body>标记之前:

<script type="text/javascript">

// Call sevenUp

sevenUp.test( options, callback );

</script>

Another thing you want to do is make sure that you are referencing the correct path to the source JavaScript file: 您要做的另一件事是确保您引用了源JavaScript文件的正确路径:

<script type="text/javascript" src="<%=ResolveClientURL("~") %>/Scripts/sevenup.0.3.min.js"></script>

Try passing an empty options object and function as a parameter. 尝试传递一个空的options对象并将其作为参数。 The options variable is NOT exposed by the script and that seems to be why it says it's undefined (because it is). 该脚本未公开options变量,这似乎就是为什么它未定义的原因(因为它是)。 The callback variable isn't exposed either. 回调变量也不公开。

sevenUp.test({}, function(){} );

You could also easily load up the page in Firefox, put up a breakpoint and inspect the local variables. 您还可以轻松地在Firefox中加载页面,设置断点并检查局部变量。

Remove the runat="server" from your <head> tag. <head>标记中删除runat="server" That should fix it. 那应该解决它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM