We help IT Professionals succeed at work.

javascript has stopped working

2,642 Views
Last Modified: 2014-08-08
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

CERTIFIED EXPERT
Expert of the Year 2014
Top Expert 2014

Commented:
What has stopped?
Dave BaldwinFixer of Problems
CERTIFIED EXPERT
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
CERTIFIED EXPERT
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
Author of the Year 2014
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION

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
CERTIFIED EXPERT
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
CERTIFIED EXPERT
Most Valuable Expert 2014
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
Most Valuable Expert 2011
Author of the Year 2014

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

Have you recently upgraded PHP?
CERTIFIED EXPERT
Expert of the Year 2014
Top Expert 2014
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
Dave BaldwinFixer of Problems
CERTIFIED EXPERT
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
CERTIFIED EXPERT
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