javascript has stopped working

johnecollins
johnecollins used Ask the Experts™
on
I have wampserver running on my laptop, with codeigniter. I have not implemented the CI javascript because it is not been completed and is experimental.

I installed the jquery package and was hapily developing and learning about jquery when it has suddenly stopped after some 9 or 10 weeks.

I have checked and I am running the latest version of firefox.

I looked in google and found references to checking firefox addons, I went through all the addons,

Extensions
I disabled all of these:-
Fireug 2.0.2,
Firefinder for Firebug 1.4,
Firephp 0.7.4,
FlashFirebug 4.8.0
JavaScript Debugger 0.9.89

Appearance Default theme 31.0

Plugins
Adobe Acrobat
Canon Image Gateway Album Plugin Utility
Java Development Toolkit 7.0.550.13 10.55.2.13
Jave TM PlatformSE 7 U55 10.55.2.13
Shockwave Flash 14.0.0.145
Shockwave for Director 12.1.1.151
Silverlight Plug-in 5.1.30514.0

Services there are no services installed

When looking at plugins I selected - check to  see if your plugins are up to date.
It showed that the Java plugins with an action "Update Now" Status of 'vulnerable' and the 'Java Development Toolkit is declared vulnerable and is blocked by Firefox since July 18 2013. When I press update now I am directed to http://www.oracle.com/technetwork/java/javase/7u65-relnotes-2229169.html which appears to offer not help with updating the java plugins.

I would be very grateful for help and recommendations so that I can run jquery again and get on with my development.

Thanks for reading this (if you make it this far) John Collins
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Expert of the Year 2014
Top Expert 2014

Commented:
What has stopped?
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Commented:
JAVA is Not javascript and jQuery (which is a javascript library).   I don't believe any of those things have anything to do with jQuery.  They have never affected the use of javascript or jquery on my computers.  Jquery must be loaded at the top of each and every page that is going to use it.

Author

Commented:
Hi Gary,

Sorry should have been clearer, I have written functions that are called by events onload of the <body> for example when a page loads I would like to set the background colour to a value set by the user affording them the opportunity to view the site with their selected bg colour. Onload fires off a js script that sets the document.body.style.backgroundcolor = the user's colour.

To help me whilst I was developing I put in alerts into the script so that I could tell what was happening in the code and this has been working fine but now no js is initilised at all.

I hope that makes it clear but any other questions please ask

John
Should you be charging more for IT Services?

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Expert of the Year 2014
Top Expert 2014

Commented:
Maybe post your code and we'll see if there's some syntax problems.
Most Valuable Expert 2011
Top Expert 2016
Commented:
Have a look at this.  It may enable you to find out what's going wrong.
https://developer.chrome.com/devtools/index

From the sound of things (sudden and complete failure) you might be missing a library or might have a file path set incorrectly.  If this script does not send an alert, you might want to reinstall your browser software.  And if it does send an alert, compare your file paths to the script's path to jQuery.  Maybe test with a one-at-a-time change of file paths.  You can see what to expect if you run it on my server, here:
http://iconoun.com/demo/jquery_hello_world.php

<!DOCTYPE html>
<html dir="ltr" lang="en-US">
<head>
<meta charset="utf-8" />
<meta name="robots" content="noindex, nofollow" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script>
$(document).ready(function(){
    alert('Hello World');
});
</script>

<title>HTML5 Page with jQuery "Hello World" Alert</title>
</head>
<body>

</body>
</html>

Open in new window

Author

Commented:
Hi Dave,
Thanks for your comments I am aware that Java is not related to javascript but I am looking at things that are not functioning well and hacve side effects perhaps.
I organise my view pages into 4 sections a header that contains the js code a navigator section that contains the page navigation, a body section that contains the specific data and a footer.

A particular page that has a lot of js in it is where users select their background colour.

<?php
if ( $this->session->userdata('logd_in'))
{
    $usertype = $this->session->userdata('ut');
    $user_name = $this->session->userdata('urnm');
    $screencolour = $this->session->userdata('colour');
    echo $screencolour;
}
else
{
    log_message('info', 'checking logged_in');
    redirect('archeryc/logout');
    $this->form_validation->set_message('verifyUser', 'You are not logged in. Please log in to continue');
}

?>
<!DOCTYPE html>
<html>
    <head>
        <link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>javascript/jquery/jquery-ui.css"/>
        <script type="text/javascript" src="<?php echo base_url(); ?>javascript/jquery/external/jquery/jquery.js"></script>
        <script type="text/javascript" src="<?php echo base_url(); ?>javascript/jquery/external/jquery/jquery-1.11.1.js"></script>
        <script type="text/javascript" src="<?php echo base_url(); ?>javascript/jquery/jquery-ui.min.js"></script>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script> 
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.0/jquery-ui.js" ></script>

        <link rel="stylesheet" href="http://localhost/archery/css/01.css" type="text/css">
        <img class = "head_imgsrc" src="http://localhost/archery/bapole.gif" width="190" height="90" />

        <section class="headerright" >
            Mail Us: <em <a href="mailto:info@bapostalleague.co.uk">info@bapostalleague.co.uk</a></em>
        </section>
        <!--<script src="funcacts.js" type ="text/javascript">charset="utf-8"></script>-->
        <script type ="text/javascript" charset="utf-8">
            
            function checkValid()
            {
                alert("in check valid");
                switch(document.myform.meeting.value)
                {
                    case '1':
                        break;
                    case '2':
                        break;
                    case '3':
                        break;
                    case '4':
                        break;
                    case '5':
                        break;
                    default:
                        alert ("The meeting number is incorrect must be from 1 - 5");
                        document.myform.meeting.focus();
                        break;
                }
            }
                         
            function myFocus()
            {
                document.myform.meeting.focus();
            }
             
            function addHrefMeeting(theHref)
            {
                alert("addhrefmeeting");
                location=theHref+document.getElementById("meetingField").value;
                return false;
            }
            
            function backcolor(color)
            {
                alert("in backcolor");
                document.body.style.backgroundColor = color;
                var current = document.getElementById("colouradj");
                current.value = color;
            }

            function toggle_pallette()
            {
                var colors = document.getElementById("colors");
                if (colors.style.visibility=== "visible")
                {
                    colors.style.visibilty="hidden";
                }
                else
                {
                    colors.style.visibilty="visible";
                }
            }

            function initial_colors()
            {
                document.getElementById('colors').style.visibilty="hidden";
            }
            
            function navWrite(var colour)
            {
                alert("in navwrite");
                document.body.style.backgroundColor = colour;
                if (document.miniform.ut.value === 'User')
                {
                    alert("in user");
                    document.getElementById('adm').visibility = 'hidden';                    
                }
                else
                {
                    alert("in admin");
                    document.getElementById('adm').visibility = "visible";
                }
            }
            
        </script>
        
        <br />
        <br />

Open in new window

header.php
Expert of the Year 2014
Top Expert 2014

Commented:
This may have nothing to do with js at all since you are using PHP
Turn error reporting on

<?php
error_reporting(E_ALL);
if ( $this->session->userdata('logd_in'))


Where is $this->session->userdata('logd_in') coming from

You are also including multiple version of jquery and jquery UI - remove then all except for the latest one.
You are currently defaulting to 1.4.2 which is a very old version.
Fixer of Problems
Most Valuable Expert 2014
Commented:
To start with, you appear to be loading 4 different versions of jquery.  You should only be using one.  And since your jqueryui appears to be version 1.9.0, that is probably the version of jquery that you should be using.
        <script type="text/javascript" src="<?php echo base_url(); ?>javascript/jquery/external/jquery/jquery.js"></script>
        <script type="text/javascript" src="<?php echo base_url(); ?>javascript/jquery/external/jquery/jquery-1.11.1.js"></script>
        <script type="text/javascript" src="<?php echo base_url(); ?>javascript/jquery/jquery-ui.min.js"></script>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script> 
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.0/jquery-ui.js" ></script>

Open in new window

Most Valuable Expert 2011
Top Expert 2016

Commented:
Have you checked the generated source code to see if the file paths are OK?

Have you recently upgraded PHP?
Expert of the Year 2014
Top Expert 2014
Commented:
UI version is nothing to do with jQuery version
UI v1.9 is compatible with all jQuery versions since 1.6 upto present
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Commented:
At least one of the jquery versions is 1.4.2....  the others are unknown.

Author

Commented:
Hi Gary,

Sorry missubmission pressed submit too early, the rest of the code -

Ray,

Thanks very much for your contribution will have a look and report back

Thank you all

John
navigator.php
prefers.php
footer.php
Expert of the Year 2014
Top Expert 2014

Commented:
Did you add the error reporting?
jQuery(document).ready(function($) {

Author

Commented:
rgranlund, thank  you for looking in

Gary, I should have told you that I was running in CodeIgniter in developmet using logging threshold of 4 so I relied on that to give me indications of where things went wrong

Ray, thanks for your contribution although I started using chrome and got a common error in chrome / safari, cannot load local resource, but it also pointed at where my error was.

Dave your contribution helped me work through the problem

Thank you, all 3 of you a further education for me

The problem was that I had put var into ,ine 96 in the header.php

function navWrite(var colour)

I took out var and it all came back I am pleased to say

Once again thank you so much

John Collins

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial