RE: jscript question?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Well, Jerry, the basics you are missing are how to properly code js. No consistency with braces...etc...just 15 minutes with a proper editor and voila it works

<html>
<script language="JavaScript1.2">
var hexinput=255;  // Initial color value.
var inc=-1;        //increment variable

function fadingad()
{
 if(hexinput>0)
 {
   hexinput-=11; // increase color value
document.getElementById("fader1").style.color="rgb("+hexinput+","+hexinput+","+hexinput+")";
   // Set color value.
   setTimeout("fadingad()",20);
 }else{
   hexinput=255  //reset hex value
 }
}
function changead()
{
 if (!document.getElementById("fader1")) return;
 inc++;
 if (inc==0){
document.getElementById("fader1").innerHTML="<img src='images/image008.jpg'>";
 }else if (inc==1){
document.getElementById("fader1").innerHTML="<img src='images/image007.jpg'>";
 }else if (inc==2){
document.getElementById("fader1").innerHTML="<img src='images/image006.jpg'>";
 }else if (inc==3){
document.getElementById("fader1").innerHTML="<img src='images/image005.jpg'>";
 }else if (inc==4){
document.getElementById("fader1").innerHTML="<img src='images/image004.jpg'>";
 }else if (inc==5){
document.getElementById("fader1").innerHTML="<img src='images/image003.jpg'>";
 }else if (inc==6){
document.getElementById("fader1").innerHTML="<img src='images/image002.jpg'>";
 }else{
document.getElementById("fader1").innerHTML="<img src='images/image001.jpg'>";
   inc=-1;
 }

 fadingad()
 setTimeout("changead()",4000);
}

</script>


<script language="JavaScript1.2">
var hexinput=255;  // Initial color value.
var inc=-1;        //increment variable

function fadingtext()
{
 if(hexinput>0)
 {
   hexinput-=11; // increase color value
document.getElementById("fader").style.color="rgb("+hexinput+","+hexinput+","+hexinput+")";
   // Set color value.
   setTimeout("fadingtext()",20);
 }else{
   hexinput=255  //reset hex value
 }
}

function changetext(){
 if (!document.getElementById("fader")) return;
 inc++;
 if (inc==0){
   document.getElementById("fader").innerHTML="Soon to be Released";
 }else if (inc==1){
document.getElementById("fader").innerHTML="What you really need to know about Testing and Tagging";
 }else if (inc==2){
document.getElementById("fader").innerHTML="250 Pages of jam-packed reality testing regimes that will maintain a safer working environment for all"
 }else if (inc==3){
document.getElementById("fader").innerHTML="Learn what's it all about before they come and do it for you - A must read for all Clients, Employers, Electricians and Competent Persons";
 }else if (inc==4){
document.getElementById("fader").innerHTML="Just when you thought you knew what testing and tagging was all about - along comes a book!";
 }else if (inc==5){
   document.getElementById("fader").innerHTML="Memberships available";
 }else if (inc==6){
document.getElementById("fader").innerHTML="Are you really doing it right?";
 }else{
document.getElementById("fader").innerHTML="<a href=order.php>Pre-order</a> and Save";
   inc=-1;
 }
 fadingtext()
 setTimeout("changetext()",8000)
}


 </script>
 <body onload="changead();changetext();">
 <center>
<div id="fader1" style="font:18px Arial bold;width:100%;color:rgb(255,255,255)"></div>
 </center>
<div id="fader" style="font:18px Arial bold;width:100%;color:rgb(255,255,255)"></div>
 </body></html>



bastien


From: JeRRy <jusa_98@xxxxxxxxx>
To: php-db@xxxxxxxxxxxxx
Subject:  jscript question?
Date: Tue, 24 Jan 2006 02:08:57 +1100 (EST)

Hi,

  I know this is not PHP/MySQl related but every other board I have
posted on I have not got a response, so I'll try here also.  I'm missing
something basic, surely here so that is another reason I am posting
here..

  Here goes...

  I have two lots of code here, one is for a refreshing text code in
Javascript and another is a banner refreshing ad system.

  Using similiar technequies.

  But I can only get the refreshing text to appear but can't get the
ads to work on the one page. :(

  But if I add a " in any text area of the text refreshing than the ads
system works but the text refreshing don't.  But if I remove the " from
any text area the text refreshing works but the ads don't.  I can't
seem to find the problem.

  Here is the code(s)

  ----ads code----

  <center>
  <script language="JavaScript1.2">
hexinput=255  // Initial color value.
var inc=-1 //increment variable
  function fadingad(){
if(hexinput>0) {
hexinput-=11; // increase color value
document.getElementById("fader1").style.color="rgb("+hexinput+","+hexinput+","+hexinput+")";
// Set color value.
setTimeout("fadingad()",20);
}
else
hexinput=255  //reset hex value
}
  function changead(){
if (!document.getElementById) return
inc++
if (inc==0)
document.getElementById("fader1").innerHTML="<img src=adtest/b1.jpg>"
else if (inc==1)
document.getElementById("fader1").innerHTML="<img src=adtest/b2.jpg>"
else if (inc==2)
document.getElementById("fader1").innerHTML="<img src=adtest/b3.jpg>"
else if (inc==3)
document.getElementById("fader1").innerHTML="<img src=adtest/b4.jpg>"
else if (inc==4)
document.getElementById("fader1").innerHTML="<img src=adtest/b5.jpg>"
else if (inc==5)
document.getElementById("fader1").innerHTML="<img src=adtest/b6.jpg>"
else if (inc==6)
document.getElementById("fader1").innerHTML="<img src=adtest/b1.jpg>"
else{
document.getElementById("fader1").innerHTML="<img src=adtest/b2.jpg>"
inc=-1
}
fadingad()
setTimeout("changead()",4000)
}
  window.onload=changead
  </script>
  <div id="fader1" style="font:18px Arial
bold;width:100%;color:rgb(255,255,255)"></div>
  </center>

  ----end ads code----

  ----text refreshing----

  <script language="JavaScript1.2">
hexinput=255  // Initial color value.
var inc=-1 //increment variable
  function fadingtext(){
if(hexinput>0) {
hexinput-=11; // increase color value
document.getElementById("fader").style.color="rgb("+hexinput+","+hexinput+","+hexinput+")";
// Set color value.
setTimeout("fadingtext()",20);
}
else
hexinput=255  //reset hex value
}
  function changetext(){
if (!document.getElementById) return
inc++
if (inc==0)
document.getElementById("fader").innerHTML="Soon to be Released"
else if (inc==1)
document.getElementById("fader").innerHTML="What you really need to
know about Testing and Tagging"
else if (inc==2)
document.getElementById("fader").innerHTML="250 Pages of jam-packed
reality testing regimes that will maintain a safer working environment for
all"
else if (inc==3)
document.getElementById("fader").innerHTML="Learn what's it all about
before they come and do it for you - A must read for all Clients,
Employers, Electricians and Competent Persons"
else if (inc==4)
document.getElementById("fader").innerHTML="Just when you thought you
knew what testing and tagging was all about - along comes a book!"
else if (inc==5)
document.getElementById("fader").innerHTML="Memberships available"
else if (inc==6)
document.getElementById("fader").innerHTML="Are you really doing it
right?"
else{
document.getElementById("fader").innerHTML="<a
href=order.php>Pre-order</a> and Save"
inc=-1
}
fadingtext()
setTimeout("changetext()",8000)
}
  window.onload=changetext
  </script>
  <div id="fader" style="font:18px Arial
bold;width:100%;color:rgb(255,255,255)"></div>

  ----end of text refreshing----

  Any help would be awsome, or solutions?

  Jerry



---------------------------------
Do you Yahoo!?
  Yahoo! Music: Check out the gig guide for live music in your area

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux