Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    External .js file doesn't working,why?

    Here is a .js file to hack ie6,but it doesn't work when i put it out of the .html file.It can woking only in the .html file.


    It's fine in the .html file. Below:
    Code:
    <html>
    <head>
    <script type="text/javascript">
    sfHover =function() {
    var sfEls = document.getElementById("nav").getElementsByTagName("LI");
    for (var i=0; i<sfEls.length; i++) {
    sfEls[i].onmouseover=function() {
    this.className+=" sfhover";
    }
    sfEls[i].onmouseout=function() {
    this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
    }
    }
    }
    if (window.attachEvent) window.attachEvent("onload", sfHover);
    </script>
    </head>
    <body>
    ......
    ......
    </body>
    </html>

    It's not working if external .js file.below:
    Code:
    <script type="text/javascript" src="suckerfish.js"></script>
    note:I haven't added the <script type="text/javascript">...<script> code to the .js file.

    any help will be good.
    Last edited by puexine; 11-15-2010 at 12:51 PM.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,730
    Thanks
    202
    Thanked 2,508 Times in 2,486 Posts
    If you are sure that there are no HTML tags in your file, check the file name and directory path........


    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

  • #3
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,801
    Thanks
    160
    Thanked 2,216 Times in 2,203 Posts
    Blog Entries
    1
    any help will be goo
    Can we have a link to your page?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #4
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    nav、LI、sfhover
    are in the .CSS file.The file name and directory path are all correct.
    Last edited by puexine; 11-15-2010 at 01:33 PM.

  • #5
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,801
    Thanks
    160
    Thanked 2,216 Times in 2,203 Posts
    Blog Entries
    1
    Could you please post your complete html,css,and js files?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #6
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    .css file:

    #nav {
    background:#3D3D3D;
    height:32px;
    padding:0px;
    margin:0px;
    width:100%;
    z-index:10;
    left:0px;
    position:absolute;
    }
    #nav ul.menu{
    left: 0px;
    position:absolute;
    display:block;
    }
    .menu li.top{
    padding-top: 6px;
    font-size: 11px;

    }
    .menu table {
    border-collapse:collapse;
    width:0;
    height:0;
    position:relative;
    top:-1px;
    left:-35px;
    }
    .menu .fly {
    background: transparent url(style/arrow.gif) no-repeat right center;
    right:0px;
    position:relative;
    }

    /*-------- Suckerfish Menu */
    #nav, #nav ul {
    float:left;
    list-style:none;
    line-height:32px;
    padding:0;
    margin:0;
    width:100%;
    font-size: 11px;
    }
    #nav li {
    position : relative;
    float:left;
    padding:0;
    }
    #nav li a {
    width: 70px;
    text-align:center;
    display: block;
    color: black;
    text-decoration : none;
    padding : 0px;
    color:white;
    }

    #nav li ul {
    position : absolute;
    left: -999em;
    margin-left: 0px;
    margin-top: 0px;
    }
    #nav li ul ul {
    margin-left : 70px;
    margin-top : -32px;
    }
    #nav li ul ul ul {
    line-height:33px\9;
    }
    #nav li a:hover {
    color : black;
    background-color : #a0a0a0;
    }

    #nav li:hover, #nav li.sfhover {
    background: #a0a0a0;
    }
    #nav li:hover ul ul, #nav li:hover ul ul ul, #nav li:hover ul ul ul ul, #nav li.sfhover ul ul, #nav li.sfhover ul ul ul, #nav li.sfhover ul ul ul ul {
    left: -999em;
    }
    #nav li:hover ul, #nav li li:hover ul, #nav li li li:hover ul, #nav li li li li:hover ul, #nav li.sfhover ul, #nav li li.sfhover ul, #nav li li li.sfhover ul, #nav li li li li.sfhover ul {
    left: auto;
    background-color : #ccc;
    width: 70px;
    }

    .js file:
    sfHover =function() {
    var sfEls = document.getElementById("nav").getElementsByTagName("LI");
    for (var i=0; i<sfEls.length; i++) {
    sfEls[i].onmouseover=function() {
    this.className+=" sfhover";
    }
    sfEls[i].onmouseout=function() {
    this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
    }
    }
    }
    if (window.attachEvent) window.attachEvent("onload", sfHover);
    site.master file:
    <%@ Master Language="C#" AutoEventWireup="true" CodeFile="site.master.cs" Inherits="StandardSite" %>
    <%@ Register Src="~/User controls/MenuControl.ascx" TagName="MenuControl" TagPrefix="uc2" %>
    <%@ Import Namespace="BlogEngine.Core" %>

    <!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" xml:lang="en" lang="en">
    <head runat="server" profile="http://gmpg.org/xfn/11">

    <script type="text/javascript" src="~/themes/standard/style/suckerfish.js"></script>
    <link rel="stylesheet" href="~/themes/standard/style/wrap.css" type="text/css" />
    <link rel="shortcut icon" href="~/pics/" type="image/x-icon"/>

    </head>
    <body>

    <div id="header">
    <p><a href="<%=Utils.AbsoluteWebRoot %>"><%=BlogSettings.Instance.Name %></a></p>
    <span><%=BlogSettings.Instance.Description %></span>
    </div>

    <div id="nav">
    <uc2:MenuControl ID="MenuControl" runat="server"
    MinutesToRefresh="0"
    SortBy="Title"
    OrderDirection="Descending"
    ShowArchivePage="True"
    ShowContactPage="True"
    ShowSearchPage="True"
    ShowCategoriesAcross="True"
    ShowGalleryPage="True"
    GalleryPageText="Photogallery"
    ShowHomePage="True"
    ShowCategoriesPage="True"
    ArchivePageText="archive"
    ContactPageText="contact"
    AdministrationText="admin"
    HomePageText="home"
    CategoriesPageText="Editorials"
    SearchPageText="search"/>
    </div>

    <form runat="Server" class="body">

    <div id="content">
    <blog:SearchOnSearch runat="server" MaxResults="3" Headline="You searched for" Text="Here are some results for the search term on this website" />
    <asp:ContentPlaceHolder ID="cphBody" runat="server" />

    <p id="footer">
    Powered by <a href="http://www.dotnetblogengine.net">BlogEngine.NET</a> <%=BlogSettings.Instance.Version() %><br />
    Theme by <a href="http://blog.madskristensen.dk">Mads Kristensen</a>
    </p>
    </div>

    <div id="sidepanel">
    <blog:WidgetZone runat="server" ZoneName="be_WIDGET_ZONE" />
    <a runat="server" id="aLogin" />
    </div>

    </form>

    </body>
    </html>

  • #7
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,801
    Thanks
    160
    Thanked 2,216 Times in 2,203 Posts
    Blog Entries
    1
    site.master file:
    Pots the parsed HTML output taken from browser's "view source" option
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #8
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

  • #9
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,801
    Thanks
    160
    Thanked 2,216 Times in 2,203 Posts
    Blog Entries
    1
    Code:
    <script type="text/javascript" src="~/themes/standard/style/suckerfish.js"></script>
    Remove that ~ from there to correct the reference.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #10
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yes,so beautiful!! thanks in advance!

    but there is still a problem,why .css file is fine?
    Code:
    <script type="text/javascript" src="/themes/standard/style/suckerfish.js"></script>
    <link rel="stylesheet" href="~/themes/standard/style/wrap.css" type="text/css" />


    thanks
    Last edited by puexine; 11-16-2010 at 10:31 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •