Sliding News

[Total: 0    Average: 0/5]

This script can be usable for sliding news on front page of web sites.

Init Code:

set_preferences();

Body Code:

 <TABLE  id="news_table" border=1 style="HEIGHT: 170px; WIDTH: 233px" >
        <TR>
          <TD>
            <MARQUEE  id="marx"  trueSpeed>
              <!-- Content which will slide -->
          Put here whatever you want
           </MARQUEE>
           <a href="mailto:seyit_rock@hotmail.com?subject=Sliding_News_feedback">E-Mail</a>
</TD>
         <TD> 
        <INPUT id="btnstat" onclick="chgStat()"  type=button value="     " style="BACKGROUND-REPEAT: no-repeat;" title="On - Off Button">
        <INPUT id="up_down" onclick="up_down(document.all('marx'))"  type=button value="     " style="BACKGROUND-REPEAT: no-repeat;" title="Change the direction of the news up or down">
        </TD>
      </TR>
    </TABLE>
<SCRIPT language=javascript>
//  '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
//  '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
//  '' Name        : set_preferences()  
// '' Inputs      : N/A
//  '' Description : sets the default values of sliding news
// '' Owner       : SEYKAY(seyit_rock@hotmail.com)
// '' DATE        : 10.10.2001 
// '' Modified By : 
// '' Important   : This function must be called from body onload
//  '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
//  '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    function set_preferences(){
//  '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 
//   you can change the propertes given below
      var sl_news_dir          = "up" ;
      var sl_news_width        = "210px" ;
      var sl_news_height    = "150px" ;
      var sl_news_brd_color    = "green" ;
      var sl_news_brd_style    = "solid" ;
      var sl_news_scrll_amount = 1 ; //Specifies the number of pixels the text scrolls between each subsequent drawing of the sliding news
      var sl_news_scrll_delay  = 100 ;//Specifies the speed of the sliding news scroll, in milliseconds 
      var sl_news_scrll_beh    = "slide" ; 
          ptImage              = "http://www.js-x.com/example/" ; //path of image directory if needed
      var sl_news_up_down      = "url(" + ptImage + "up.gif)" ;
      var sl_news_on_off       = "url(" + ptImage + "online.gif)" ; 

//Do not exceed the following line
//  '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 
      var  objMar = document.all("marx") ;
      objMar.direction      = sl_news_dir ;
      objMar.style.width    = sl_news_width  ;
      objMar.style.height   = sl_news_height ;
      objMar.style.BEHAVIOR = sl_news_scrll_beh ;
      objMar.scrollDelay    = sl_news_scrll_delay ; 
      objMar.scrollAmount   = sl_news_scrll_amount ; 
objMar.style.borderColor = sl_news_brd_color ;
      objMar.style.borderStyle = sl_news_brd_style ;
      document.all('up_down').style.backgroundImage = sl_news_up_down;
      document.all('btnstat').style.backgroundImage = sl_news_on_off;
}
//  '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
//  '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
//  '' Name        : up_down(objMar)  
// '' Inputs      : objMar; marquee object
//  '' Description : change the sliding news direction (up or down)
// '' Owner       : SEYKAY(seyit_rock@hotmail.com)
// '' DATE        : 10.10.2001 
// '' Modified By : 
//  '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
//  '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

function up_down(objMar){
  if ((document.all('up_down').style.backgroundImage) == "url(" + ptImage + "up.gif)") {
      document.all('up_down').style.backgroundImage = "url(" + ptImage + "down.gif)"
objMar.direction = "down";
     }else{
        document.all('up_down').style.backgroundImage = "url(" + ptImage + "up.gif)"
objMar.direction = "up";
     } 
   }
//  '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
//  '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
//  '' Name        : chgstat
// '' Inputs      : N/A
//  '' Description : changes the status of the sliding news (on or off)
// '' Owner       : SEYKAY (seyit_rock@hotmail.com)
// '' DATE        : 10.10.2001 
// '' Modified By : 
//  '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
//  '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
   function chgStat(){
     if ((document.all('btnstat').style.backgroundImage)== "url(" + ptImage + "offline.gif)") {
      document.all('btnstat').style.backgroundImage = "url(" + ptImage + "online.gif)"
      document.all('marx').start()
     }else{
        document.all('btnstat').style.backgroundImage = "url(" + ptImage + "offline.gif)"
      document.all('marx').stop()
   } 
  }
</SCRIPT>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *