tags:

views:

252

answers:

3

Hi

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/

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"&gt;
<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"&gt;
<html xmlns="http://www.w3.org/1999/xhtml"&gt;
<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. Since this really does not need serverside stuff.


Here is a standard html page.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;
<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.

+1  A: 

You're using ASP.NET and the Body OnLoad is not a great place for putting JavaScript hooks.

Add this to the very bottom of your page before the </body> tag:

<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:

<script type="text/javascript" src="<%=ResolveClientURL("~") %>/Scripts/sevenup.0.3.min.js"></script>
Nissan Fan
hmm does not seem to work.
chobo2
A: 

Remove the runat="server" from your <head> tag. That should fix it.

Eli Grey
Nope you can see what I did now. I just made a simple html page and I still get options not defined. If you got it working please post up your html code so I can see it or could you send me a zip with all the scripts?
chobo2
+1  A: 

Try passing an empty options object and function as a parameter. The options variable is NOT exposed by the script and that seems to be why it says it's undefined (because it is). 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.

neonski
Ya that worked but man the plugin sucks. On local host it take a few seconds to render. Sigh Waste of time oh well you deserve the 100 points.
chobo2