[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

javascript has stopped working

Posted on 2014-08-04
16
Medium Priority
?
875 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
0
Comment
Question by:johnecollins
  • 5
  • 4
  • 3
  • +2
15 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 40239593
What has stopped?
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 40239595
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.
0
 

Author Comment

by:johnecollins
ID: 40239624
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
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 58

Expert Comment

by:Gary
ID: 40239630
Maybe post your code and we'll see if there's some syntax problems.
0
 
LVL 111

Assisted Solution

by:Ray Paseur
Ray Paseur earned 668 total points
ID: 40239854
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

0
 

Author Comment

by:johnecollins
ID: 40239861
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
0
 
LVL 58

Expert Comment

by:Gary
ID: 40239870
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.
0
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 668 total points
ID: 40239952
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

0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 40239953
Have you checked the generated source code to see if the file paths are OK?

Have you recently upgraded PHP?
0
 
LVL 58

Assisted Solution

by:Gary
Gary earned 664 total points
ID: 40239957
UI version is nothing to do with jQuery version
UI v1.9 is compatible with all jQuery versions since 1.6 upto present
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 40239966
At least one of the jquery versions is 1.4.2....  the others are unknown.
0
 

Author Comment

by:johnecollins
ID: 40239993
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
0
 
LVL 58

Expert Comment

by:Gary
ID: 40240010
Did you add the error reporting?
0
 
LVL 7

Expert Comment

by:rgranlund
ID: 40240069
jQuery(document).ready(function($) {
0
 

Author Closing Comment

by:johnecollins
ID: 40248601
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
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to implement server side field validation and display customized error messages to the client.
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Suggested Courses
Course of the Month19 days, 2 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question