Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Web Coding › syntax error need help
New Posts  All Forums:Forum Nav:

syntax error need help

post #1 of 2
Thread Starter 
ok im trying to add this itunes like slider to my site im having a little trouble with the coding here what i have
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link rel="stylesheet" type="text/css" href="style99.css" />
<script type="text/javascript" src="itunes.js"></script> 

</head>

<body>
<div id="wrap">
   <div id ="header"><img src="testbanner2.jpg" width="750" height="95" alt="Ryan Paeglow" />
   
   
  </div>
   
    
   <ul id="nav">
      <li><a href="#">About me</a></li>
      <li><a href="#">Our Products</a></li>
      <li><a href="#">FAQs</a></li>
      <li><a href="#">Contact</a></li>
      <li><a href="#">Login</a></li>
   </ul>
   
<div id="gallery">
        <img src="key_art_miami_dolphins.jpg" alt="" width="452" height="225" />
        <img src="imagesCATAO8Z0.jpg" alt="" />
        <img src="MiamiDolphinsPHelmet_display.jpg" alt="" width="172" height="191" />
        <img src="miami-dolphins-profile.jpg" alt="" width="112" height="168" />
        </div>
 
 
<div id="thumbs">
  <img src="key_art_miami_dolphins.jpg" alt="" />
  <img src="imagesCATAO8Z0.jpg" alt="" />
  <img src="MiamiDolphinsPHelmet_display.jpg" alt="" />
  <img src="miami-dolphins-profile.jpg" alt="" />
</div>
</body>
<html>
Code:
#nav {
        width: 100%;
        float:left;
        margin: 0 0 3em 0;
        padding: 0;
        list-style: none;
        background-color: #000;
    }
   #nav li {
      float: left; }
   #nav li a {
        display: block;
        padding: 8px 15px;
        text-decoration: none;
        font-family: "Comic Sans MS", cursive;
        font-size: 1.15em;
        font-weight: bold;
        color: #fff;
        border-style: none;

   }
   #nav li a:hover {
        color: #FFF;
        background-color: #A9A9A9;
          }
   /* End navigation bar styling. */
   
   /* This is just styling for this specific page. */
   body {
        background-color: #DBC8A5;
        font: small/1.3 Arial, Helvetica, sans-serif;
}
   #wrap {
      width: 750px;
          margin-top: 25px;
          margin-left: auto;
          margin-right:auto;
          margin-bottom:auto;
      background-color: #F5F5F5; }
                  
 
   #content {
      padding: 0 50px 50px; }
          #gallery, #thumbs {
        float: left;
}
#gallery-overlay {
        position: absolute;
        display: block;
        width: 800px;
        height: 300px;
        z-index: 200;
}
#gallery {
        width: 550px;
        height: 300px;
        overflow: hidden;
}
#gallery img {
        position: absolute;
        display: block;
}
#thumbs {
        width: 200px;
        height: 300px;
        overflow: hidden;
}
#thumbs img {
        width: 200px;
        height: 100px;
}
.clear {
        clear: both;
}
Code:
$(document).ready(function() {
        var index = 0;
        var images = $("#gallery img");
        var thumbs = $("#thumbs img");
        var thumbsHeight = 100;
        thumbs.slice(0,3).clone().appendTo("#thumbs");
        for (i=0; i
&lt;(thumbs.length-1)){index+=1 ; }
                else {index=0}   its coming up the error at this line
                show (index);
        }
        function show(num) {
                images.fadeOut(400);
                $(".image-"+num).stop().fadeIn(400);
                var scrollPos = (num+1)*thumbsHeight;
                $("#thumbs").stop().animate({scrollTop: scrollPos}, 400);
        }
});
My System
(15 items)
 
  
CPUMotherboardGraphicsRAM
AMD FX 8350 Asus M5a99FX Pro R2.0 EVGA GeForce GTX 660 2Gb CORSAIR XMS3 8GB (4 x 2GB) 
Hard DriveHard DriveCoolingOS
WD 500 Gb sata, WD 1TB Samsung 840 EVO 120 GB Corsair H110 Windows 10 
PowerCase
CORSAIR 750W Corsair 500r 
  hide details  
Reply
My System
(15 items)
 
  
CPUMotherboardGraphicsRAM
AMD FX 8350 Asus M5a99FX Pro R2.0 EVGA GeForce GTX 660 2Gb CORSAIR XMS3 8GB (4 x 2GB) 
Hard DriveHard DriveCoolingOS
WD 500 Gb sata, WD 1TB Samsung 840 EVO 120 GB Corsair H110 Windows 10 
PowerCase
CORSAIR 750W Corsair 500r 
  hide details  
Reply
post #2 of 2
Quote:
Originally Posted by rdpaeglow501 View Post

ok im trying to add this itunes like slider to my site im having a little trouble with the coding here what i have
Code:
$(document).ready(function() {
        var index = 0;
        var images = $("#gallery img");
        var thumbs = $("#thumbs img");
        var thumbsHeight = 100;
        thumbs.slice(0,3).clone().appendTo("#thumbs");
        for (i=0; i
&lt;(thumbs.length-1)){index+=1 ; }
                else {index=0}   its coming up the error at this line
                show (index);
        }
        function show(num) {
                images.fadeOut(400);
                $(".image-"+num).stop().fadeIn(400);
                var scrollPos = (num+1)*thumbsHeight;
                $("#thumbs").stop().animate({scrollTop: scrollPos}, 400);
        }
});

That Javascript doesn't make sense. the line with an error has an 'else' statement but you don't have an 'if' statement before it.
Main PC
(13 items)
 
  
CPUMotherboardGraphicsRAM
i5 2500k Asus Maximus IV Gene-Z MSI 6950 2gb Unlocked Ref GSkill Ripjaws X 8GB CL8 
Hard DriveOSMonitorKeyboard
Crucial M4 128GB Windows 7 Ult Samsung 24" ToC Das Professional Silent 
PowerCaseMouse
Seasonic X750 Corsair 650d Logitech G700 
  hide details  
Reply
Main PC
(13 items)
 
  
CPUMotherboardGraphicsRAM
i5 2500k Asus Maximus IV Gene-Z MSI 6950 2gb Unlocked Ref GSkill Ripjaws X 8GB CL8 
Hard DriveOSMonitorKeyboard
Crucial M4 128GB Windows 7 Ult Samsung 24" ToC Das Professional Silent 
PowerCaseMouse
Seasonic X750 Corsair 650d Logitech G700 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Web Coding
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Web Coding › syntax error need help