SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard billy_111's Avatar
    Join Date
    Jul 2009
    Posts
    1,683
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JavaScript in WP

    Hey,

    I am trying to use the following code in my header.php as i am trying to use a wordpress theme.. But the javascript file does not seem to be recoginzed. I have tried the code in a html file and it works fine.

    The javascript is for a navigation menu for drop down links, the code is below:-

    <!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>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> &raquo; Blog Archive <?php } ?> <?php wp_title(); ?></title>

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

    </script>

    <!--[if !IE]><!-->
    <style type="text/css">@import 'firefox.css';</style>
    <!--<![endif]-->

    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" />

    </head>
    <body>
    <div id="page">
    <div id="header">
    <div class="chromestyle" id="chromemenu">
    <ul>
    <li><a href="index.html">Home</a></li>
    <li><a href="#" rel="dropmenu2">About Us</a></li>
    <li><a href="#" rel="dropmenu3">Food &amp; Drink</a></li>
    <li><a href="blog" rel="dropmenu4">News</a></li>
    <li><a href="#" rel="dropmenu5">Contact Us</a></li>
    </ul>
    </div>


    <!--2nd drop down menu -->
    <div id="dropmenu2" class="dropmenudiv" style="width: 150px;">
    <a href="intro.html">Introduction</a>
    <a href="">Our location</a>
    <a href="">Links and partners</a>

    <a href="">Awards</a>
    <a href="">Sustainability</a>
    <a href="">Videos</a>
    </div>

    <!--3rd drop down menu -->
    <div id="dropmenu3" class="dropmenudiv" style="width: 150px;">
    <a href="">Media clips</a>
    <a href="">Producer diarys</a>
    <a href="">Hotelier of the month</a>

    <a href="">Events</a>
    <a href="">Recipe ideas</a>
    <a href="">Sustainability</a>
    </div>

    <!--4th drop down menu -->
    <div id="dropmenu4" class="dropmenudiv" style="width: 150px;">
    <a href="">Media clips</a>
    <a href="">Producer diarys</a>
    <a href="">Hotelier of the month</a>

    <a href="">Events</a>
    <a href="">Recipe ideas</a>
    <a href="">Sustainability</a>
    </div>

    <!--4th drop down menu -->
    <div id="dropmenu5" class="dropmenudiv" style="width: 170px;">
    <a href="">Enquiry form</a>
    <a href="">Feeback</a>
    <a href="">Recommend retail outlet</a>
    </div>

    <script type="text/javascript">

    cssdropdown.startchrome("chromemenu")

    </script>

    <div id="title">Latest News</div>

    </div>
    <!--/header -->

    Now, when i try this in IE the yellow error icon appears at the bottom left and gives the following error:-


    Webpage error details

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; InfoPath.2; .NET CLR 3.5.30729; .NET CLR 3.0.30618)
    Timestamp: Wed, 22 Jul 2009 10:57:22 UTC


    Message: 'cssdropdown' is undefined
    Line: 74
    Char: 1
    Code: 0
    URI: http://www.listentotheconstituents.com/mey/blog/

    Does anybody know what this error means?

    Thanks,
    Regards

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    According to your SCRIPT element, the file "chrome.js" should be at http://www.listentotheconstituents.c...blog/chrome.js

    However, that's a 404. I'm guessing the chrome.js is actually within wp-content/themes/

    You have a similar problem with your News link.


Bookmarks

Posting Permissions

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