Can someone explain why there is a synax error in this code

I am relatively new to Dreamweaver and JavaScript and I am trying to create a sequence of traffic lights that runs automatically, the code does not really work, but there is an error of syntax on line 52 and line is completely empty, can someone tell me why?

Here is the code

<!DOCTYPE html>
<html>
<body>

<img id="Change Lights" src="red.gif" width="36" height="98">
<br><button onclick="automatic()" id="button">Change colour</button></br>
<script>
var img = "red.gif";
        var trafficLights = ["red.gif","redamber.gif","yellow.gif","green.gif"] 
        
  function green() {
            document.images[0].src == trafficLights[3]
        } 
 
        function yellow() {
            document.gif[0].src == trafficLights[2];
        }
        function redamber() {
            document.gif[0].src == trafficLights[1];
        }
        function red() {
            document.gif[0].src == trafficLights[0];
        }
        function yellow() {
            document.gif[0].src == trafficLights[3];
        }

              function automatic() {
 
    if (trafficLight == "green.gif") {
        setTimeout(green.gif,500);
  
        trafficLight == "yellow.gif";
    } else if (trafficLight == "yellow.gif") {
        setTimeout(yellow.gif,500);
  
        trafficLight == "redYellow.gif";
    } else if (trafficLight == "redamber.gif") {
        setTimeout(redamber.gif,500);
  
        trafficLight == "red.gif";
    } else if (trafficLight == "red.gif") {
        setTimeout(red.gif,500);
  
        trafficLight == "yellow.gif";       
    } else {
        setTimeout(yellow.gif,500);
        trafficLight == "green.gif";
    } 

var interval = setInterval(automatic,1000);

</script>  
</body>
<html>

In addition to the errors of HTML that were reported to you, there is an error in the JavaScript code. The closing brace of the function automatic() is missing.

Add to the 50 line.}

The syntax error is displayed as being on line 52 as a missing closing brace always generates an error at the end of the script. The parser found the opening brace and continues the research of corresponding to the brace to the end.

Tags: Dreamweaver

Similar Questions

  • Whenever I try to download a file, I get a message that the internet explore has encountered a problem and need to close. Can someone explain why this is?

    Whenever I try to download a file, I get a message that the internet explore has encountered a problem and need to close. Can someone explain why this is?

    What Service Pack for XP are you running?  You use Internet Explorer 7 or 8?   If so, you can try this article to see if it solves your problem:

    "How to reset Internet Explorer settings"
      <>http://support.Microsoft.com/kb/923737 >

    HTH,
    JW

  • I try to install FontAwesomePS_1.0.0 for Photoshop CC15. This extension cannot be mounted, it requires the version of photoshop 64 to inclusively between 14.0 and 15.9. Can someone explain why this extension is not installed? Thank you!

    I try to install FontAwesomePS_1.0.0 for Photoshop CC15. This extension cannot be mounted, it requires the version of photoshop 64 to inclusively between 14.0 and 15.9. Can someone explain why this extension is not installed? Thank you!

    Looks like you are installing in the extensions manager that is no longer supported for 2015 of CC. Please refer to the CC app instead.

  • Can someone explain why all my Spry assets on a website online have suddenly stopped working?

    Can someone explain why all my Spry assets on a website online have stopped responding? I checked that Spry CSS and JS files are in place. Then checked the files on Dreamweavers mode live view and they do not work here either. It was fine a few weeks ago that it's almost as if the web browsers stopped tearing Spry, for example, the links for the collapsible panels are not yet recognized as links.

    I use 'old' on Dreamweaver CS4 spry assets (if that makes a difference). Active Spry tabbed panels are removable panels.

    Thanks for your help.

    Manufacturers should come after the library. In other words, you have moved libraries below links

    
    

    Move high to the bottom of your page and everything is fine.

    This brings me to ask why you do not use SpryCollapsiblePanelGroup as in Spry/SpryCollapsiblePanelGroup.html to the adobe/Spry master · GitHub

    Of course, if you want to be really up-to-date, try the version of jQuery http://jqueryui.com/accordion/

  • Can someone explain why a 72 dpi, which went to print looked great?

    Not sure if I should post this in Photoshop or InDesign forum.

    I'm working on bringing a book in InDesign that will be printed at one of these free publishing houses. I did a lot in the past. Then my friend I do a lot of work with a book on his own that has a photo to grayscale to a bomber B-24 on the lid. The image was of 72 dpi and the dimensions of the image were 52,389 "X 35,722". In InDesign, the image has been resized to about 7 inches wide. The book is back and the cover photo was beautiful. What is confusing to me, this is why the cover photo looked not all pixelated because he was of 72 dpi. Is it something about the picture that he was so great that it is a dimension, and then it has been scaled down? Can someone explain this somehow?

    Just a note: auto publication companies I beleave not print their books on an offset press. I think they use high range laser printers. But I could be wrong.

    Thank you

    Russ

    iRuss wrote:

    The image was of 72 dpi and the dimensions of the image were 52,389 "X 35,722". In InDesign, the image has been resized to about 7 inches wide.

    How the effective resolution has become something of the order of 538.56 ppi (52.389/7 x 72). What the actual resolution of the image scale changes in proportion reverses with the scale factor. It's exactly the same thing as changing the width of the 7-inch image in Photoshop without resampling. No pixels change, you change just the size you choose to print.

  • Can someone explain why this code is not overwrite another file on the sd card?

    I use a table of bitmap with a few different images. According to a trigger, I want to change the wallpaper of the home screen blackberry in the image of my choice. I can do that for 1 single image, it is not updated while it should be. Here is my code, help! :

    * Note [D.kF] is an array of Bitmap

    * D.bgNumber evolves according to the program (that is to say, it takes a different image)

    Card graphics graphics = Graphics.create (D.kF [D.bgNumber]);

    Encoder JPEGEncodedImage = JPEGEncodedImage.encode(D.kF[D.bgNumber],100);
    try {}
    ExtendedFileConnection fconn = (ExtendedFileConnection) connector
    .the ("file:///store/home/user/pictures/image.jpg",
    Connector.READ_WRITE);
    fconn.enableDRMForwardLock ();
    {if(!fconn.) Exists())}
    fconn. Create();
    }
    OutputStream os = fconn.openOutputStream ();
    OS. Write (Encoder.GetData ());
    OS. Close();
    fconn. Close();
    } catch (Exception e) {}
    System.out.println ("output file error:" + e.getMessage ());
    }

    HomeScreen.setBackgroundImage("file:///store/home/user/pictures/image.jpg");

    Sorry, I borrowed this code for my own purposes, so I'm quite foggy as to its functions. I have just made a run through in the Simulator and noticed that the image has been "locked" in the actual file. He says DRM Forward Lock. Now I read a little about it and I thought it was a necessary element of this encoding.

    In any case, I reduced on the line of lock forward and his now appear correctly as the home screen. So I guess its resolved, but, you, what is the purpose of the lock?

  • Compaq Presario cq62: can someone explain why you need recovery disc?

    Look, I want to buy a new drive hard because one broke, and when I install it on my pc (I'll have to recovery disk)? or I can install windows instantly?

    Hello

    Broke is a term very vague for a HARD drive, and if the HARD drive has some life left in it, then a clone may be possible.

    You do not have need of recovery disks, you can return your system to factory fresh, but change to another OS you have it means you don't need the recovery disc.

    As explained the situation with the drivers and applications means that you struggle to get a stable system, and the new approach factory denies all this trouble.

    If there is life in the old disk HARD a game of media recovery can be able to produce from it, perhaps a clone would also give this option, but only a remote possibility.

  • Please can someone explain why the windows Installer keeps appearing when nothing is installed? Any way to stop this?

    Why the Windows Installer keep popping up, either on a web page or an e-mail to the office when nothing is installed.  No way to stop that... ?

    The desktop of your computer, click on the tab "Start", usually located at the bottom left of the screen (on Vista, it's maybe the windows symbol instead of the word 'Start').

    Now, find and click on the program title 'run '. Vista users can locate this program by typing "run" in the area of research at the bottom of the menu 'start '.

    Once you open 'Run', type 'MSCONFIG' in the empty box and click 'OK '. This will open the System Configuration utility.

    With the open System Configuration utility, select the tab "Services".

    Scroll down the list of services (it may be advantageous to click on the 'service' column to sort the services by alphabetical order) until you find the program "Windows Installer".

    Now, click on the checkbox next to the name of the Windows Installer and click on the button 'Disable' at the bottom of the Configuration of the system.

  • Can someone explain why these two paintings 'look' different even if they are from the same source?

    Hi all!

    I'm just curious, why these two tables are different and are they really different in terms of structure, even if they are from the same source? The left is the exit of tdms get properties and the other is a power of arry auto indexed.

    Nilesh-

    No doubt, you are referring to the visual aspect, since the data are the same. One of them uses a different type of indicator of the chain. You probably click right and choose 'create-> Indicator '. When you perform this LabVIEW will use the same style of indicator as what sub-VI/uses. In case you made directly from the PDM function, but the other was created between the autoindex loop tunnel for, in the second he used everything that was default in your preferences.

  • Can someone explain why so many 'normal' sites are listed as Untrusted and fraudulent i.e. Microsoft, Yahoo, Google, Skype etc.

    Instant download of certmgr.msc page of the issue.

    It is not the sites themselves which are not reliable, but the certificate of identification. Certificates are used to ensure encrypted Internet communication. Certificates are distributed from a certificate authority, and if it is established the certificate has been stolen or acquired by providing false information, it will revoke the. This is what your seeing. The listed certificates will not be used. For example, one of the certificates say mail.google.com. Which could be used to fool someone logging into a fake Gmail page. The page could look exactly like Gmail and that you would never know that you just put your credentials.

    Hope this helps,

    Bob

  • Can someone explain why only a part of a song into my iMovie transfers? I select the whole song, but if I transfer it the song fades at some point to halfway through, then fades and once again. I transfer an MP3 to iTunes

    Maybe video clips, where the track of the song is dimmed have set "the volume of the other clips.  Select one of these clips and click on the speaker icon:

    If it is, uncheck it.

    You might also ' Mute audio ' for these clips:

    in which case click the icon of speaker with red line through it.

    What is described in full in the help files in the: http://help.apple.com/imovie/mac/10.1/#/mov84788882d

    Geoff.

  • Can someone explain why my 3 pro surface not precisely use the Brush tool in adobe illustrator?

    My Pro 3 surface is amazing with photoshop, but it cuts in and out using the Brush tool in illustrator.  Does anyone know a fix?

    Fresco of Dinar salvation,

    We saw a few problem with n-trig win drivers tab on surface pro 3. Here's a post on the forum with a https://forums.adobe.com/thread/1649008?q=surface%20pro solution

    Sanjay.

  • Can someone explain please the 4SNS/1/40000000 error code: TMOP - 127.875 and how to solve the problem?

    AHT error code.

    You have problems? Why do you run Apple hardware *?

    Of

    http://www.CNET.com/news/how-to-invoke-and-interpret-the-Apple-hardware-tests/

    which would indicate a bad sensor on one of your memory modules or riser:

    In the case of an error in probe (4SNS), to determine what type of sensor is referenced, look for his first letter, which should be 'I' for the current "V" or "T" for temperature, voltage.

    Then check the second letter from the list below to see which component it refers to:

    A: ambient air sensor
    B: battery
    C: Central processors (CPU)
    D: DC (direct current)
    e: PCI-express slot
    F: FireWire port
    G: graphics processor (GPU)
    H: drive
    h: heat pipe (heat sink)
    L: liquid crystal display
    M: memory or the memory riser cards

    I would first install a monitoring app like Mac Fan Control of temperature

    http://www.CrystalIDEA.com/Macs-fan-control

    to see of you can find a bad sensor by reading the memory riser card.

    You have a MacBook Pro as indicated: MacBook Pro, OS X Yosemite (10.10.5)

    Since this is the Mac Pro desktop forum

  • why the output is 1. can someone explain

    What is the result of the following

    StringBuffer sb1 = new StringBuffer("Amit");

    StringBuffer sb2 = new StringBuffer("Amit");

    String ss1 = 'Amit';

    System.out.println(sb1==SB2);

    System.out.println (sb1. Equals (SB2));

    System.out.println (sb1. Equals (SS1));

    System.out.println ("Poddar". Substring (3));




    Years:
    (a) false
    fake
    fake
    Dar
    (b) false
    true
    fake
    Poddar
    (c) compiler error
    (d) true
    true
    fake
    Dar


    Correct A

    Can someone explain why the answer is?

    try to create a sampling program and run u will know.

    equal to equal is method in the string class.

  • Can someone explain to me why XP sometimes creates a double XP profile.

    Can someone explain to me why XP sometimes creates a double XP profile. For example Neo (domain)?

    Hello

    1. is the computer connected to the domain?
    2. don't you make changes to the computer before the show?

    This behavior can occur if the user profile was deleted manually using the command prompt or by using Windows Explorer. A profile that is manually deleted does not remove the security identifier (SID) of the list of profiles in the registry.

    To resolve this issue, follow these steps:

    1 delete the profile by using the computer properties dialog box. To do this, follow these steps:

    a. click Start, right click my computerand then click Properties.

    b. click on change settings.

    c. in the System Properties dialog box, click the Advanced tab.

    d. under user profiles, click settings.

    e. in the user profiles dialog box, select the profile that you want to remove, click Remove, and then click OK.

    2. click on Start, type regedit in the box Start Search and press ENTER.

    3. Locate, and then expand the following registry subkey:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList

    4 right-click the SID that you want to remove and then click Remove.

    5 log on to the computer and create a new profile.


    Important
    this section, method, or task contains steps that tell you how to modify the registry. However, serious problems can occur if you modify the registry incorrectly. Therefore, make sure that you proceed with caution. For added protection, back up the registry before you edit it. Then you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click on the number below to view the article in the Microsoft Knowledge Base: 322756 (http://support.microsoft.com/kb/322756/) how to back up and restore the registry in Windows.

    You can also download the UPHClean from the following location:
    http://www.Microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=1b286e6d-8912-4e18-B570-42470e2f3582

Maybe you are looking for