Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Script validation errors
Old 08-10-2009, 07:57 PM Script validation errors
Junior Talker

Posts: 4
Trades: 0
hello,

I had 0 validation errors. but after installing this script, validation programm has shown me 34 new errors. I fixed some of them, but the rest of them I dont know how to fix.

my website is www.kava.hr and I checked it on a http://www.validome.org/validate/?ur...://www.kava.hr
the code is
Code:
<script type="text/javascript">

/***********************************************
* Fading Scroller- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var delay =200; //set delay between message change (in miliseconds)
var maxsteps=30; // number of steps to take to change from start color to endcolor
var stepdelay=200; // time in miliseconds of a single step
//**Note: maxsteps*stepdelay will be total time in miliseconds of fading effect
var startcolor= new Array(255,255,255); // start color (red, green, blue)
var endcolor=new Array(0,0,0); // end color (red, green, blue)

var fcontent=new Array();
begintag='<div style="font: normal 12px Arial; padding: 5px;">'; //set opening tag, such as font declarations
fcontent[0]="<b>10.-12.rujna 2009.</b><br>Eu' Vend - Köln, Njemačka<br><br>Četvrti međunarodni sajam automata za kavu.";
fcontent[1]="<b>2.-4.listopada 2009.</b><br>Europski sajam - Lyon, Francuska<br><br>Europski sajam, sajam hrane i pića, sajam kave.";
fcontent[2]="<b>10.-14.listopada 2009.</b><br>ANUGA - Köln, Njemačka<br><br>Najznačajnija izložba hrane i pića u svijetu.";
fcontent[3]="<b>Lipanj 2010.</b><br>Rafa - Prag, Češka<br><br>Četvrti međunarodni simpozij o novostima u analizi hrane.";
fcontent[4]="<b>25.-27.travnja 2010.</b><br>Tea & Coffee World Cup - Beč, Austrija<br><br>Međunarodni sajam koji pokriva sva područja industrije kave i čaja.";
fcontent[5]="<b>28.-30.kolovoza 2010.</b><br>TriestEspresso Expo - Trst, Italija<br><br>Peto izdanje međunarodnog sajma za profesionalce iz svih područja iz industrije kave.";
fcontent[6]="<b>Lipanj 2010.</b><br>World Barista Championship - London, Velika Britanija<br><br>Svjetsko natjecanje barista u spravljanju espressa.";
closetag='</div>';

var fwidth='140px'; //set scroller width
var fheight='150px'; //set scroller height

var fadelinks=1;  //should links inside scroller content also fade like text? 0 for no, 1 for yes.

///No need to edit below this line/////////////////


var ie4=document.all&&!document.getElementById;
var DOM2=document.getElementById;
var faderdelay=0;
var index=0;


/*Rafael Raposo edited function*/
//function to change content
function changecontent(){
  if (index>=fcontent.length)
    index=0
  if (DOM2){
    document.getElementById("fscroller").style.color="rgb("+startcolor[0]+", "+startcolor[1]+", "+startcolor[2]+")"
    document.getElementById("fscroller").innerHTML=begintag+fcontent[index]+closetag
    if (fadelinks)
      linkcolorchange(1);
    colorfade(1, 15);
  }
  else if (ie4)
    document.all.fscroller.innerHTML=begintag+fcontent[index]+closetag;
  index++
}

// colorfade() partially by Marcio Galli for Netscape Communications.  ////////////
// Modified by Dynamicdrive.com

function linkcolorchange(step){
  var obj=document.getElementById("fscroller").getElementsByTagName("A");
  if (obj.length>0){
    for (i=0;i<obj.length;i++)
      obj[i].style.color=getstepcolor(step);
  }
}

/*Rafael Raposo edited function*/
var fadecounter;
function colorfade(step) {
  if(step<=maxsteps) {    
    document.getElementById("fscroller").style.color=getstepcolor(step);
    if (fadelinks)
      linkcolorchange(step);
    step++;
    fadecounter=setTimeout("colorfade("+step+")",stepdelay);
  }else{
    clearTimeout(fadecounter);
    document.getElementById("fscroller").style.color="rgb("+endcolor[0]+", "+endcolor[1]+", "+endcolor[2]+")";
    setTimeout("changecontent()", delay);
    
  }   
}

/*Rafael Raposo's new function*/
function getstepcolor(step) {
  var diff
  var newcolor=new Array(3);
  for(var i=0;i<3;i++) {
    diff = (startcolor[i]-endcolor[i]);
    if(diff > 0) {
      newcolor[i] = startcolor[i]-(Math.round((diff/maxsteps))*step);
    } else {
      newcolor[i] = startcolor[i]+(Math.round((Math.abs(diff)/maxsteps))*step);
    }
  }
  return ("rgb(" + newcolor[0] + ", " + newcolor[1] + ", " + newcolor[2] + ")");
}

if (ie4||DOM2)
  document.write('<div id="fscroller" style="border:1px solid black;width:'+fwidth+';height:'+fheight+'"></div>');

if (window.addEventListener)
window.addEventListener("load", changecontent, false)
else if (window.attachEvent)
window.attachEvent("onload", changecontent)
else if (document.getElementById)
window.onload=changecontent

</script>
croxxx69 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-10-2009, 08:06 PM Re: Script validation errors
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
wrap the script in CDATA tags http://www.w3schools.com/xmL/xml_cdata.asp so the validator ignores them.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-13-2009, 11:11 AM Re: Script validation errors
Junior Talker

Posts: 4
Trades: 0
thank you, interesting answer.

I put all javascript in a separate file and now there is no errors any more.

But I'll remember your suggestion for resolving some similar situations.
croxxx69 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Script validation errors
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11572 seconds with 12 queries