WordPress.org

Ready to get started?Download WordPress

Forums

Javascript doesn't work, only through WP (4 posts)

  1. vavroom
    Member
    Posted 7 years ago #

    I'm at a loss. Hope someone might have an idea for me.

    I don't use javascript very often, but I have a situation that calls for it. I'm using two js files to create a tab effect on a page.

    The script and html/css works fine if I use it as a stand alone.

    When I include in my sidebar, it suddenly doesn't work at all anymore.

    I placed both js files in a folder called /js in my theme.

    The files are tabs.js and prototype.js

    I call both of the js through the head of my document as is:
    <script src="<?php bloginfo('url'); ?>/wp-content/themes/mythemename/js/tabs.js" type="text/javascript" ></script>

    I include a bit more of js that actually triggers the script as follows:

    <script type="text/javascript">
    		<!--
    Event.observe(window,'load',function(){
            $$('.tabs').each(function(tabs){
                new Control.Tabs(tabs);
            });
        });
        //-->
    </script>

    I read through http://codex.wordpress.org/Using_Javascript#Using_Multiple_Javascript_Files_inside_one_post_or_page and spend a couple hours sifting through this forum, haven't found a thing.

    I tried removing most WP calls from the head, removed the actual post stuff and only loading the sidebar. To no avail.

    There's obviously a conflict somewhere. But I can't, for the life of me, figure out what might be not happy.

    Unfortunately, I don't have a live site to show you at the moment, it's all local. Early on the design process of the site, but if this tab feature won't work, I have to abandon the design

    Thanks for any assistance.

  2. vavroom
    Member
    Posted 7 years ago #

    Anyone? Please?

  3. drmike
    Member
    Posted 7 years ago #

    Can you check to see if the outputted link is correct?

  4. vavroom
    Member
    Posted 7 years ago #

    drmike, sorry for the delays in coming back to you.

    Yes, it was one of the first thing I did, checking on the link. The output link once copied from the source of the html page and pasted into the browser's URL window brings up the script.

    I've also tried setting the permissions to 777, in case, but it made no difference.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags