csmit195

Sana Code Fix #1

Mar 30th, 2016
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.62 KB | None | 0 0
  1. <script type="text/javascript">
  2. var tWidth = '100%'; // width (in pixels)
  3. var tHeight = '25px'; // height (in pixels)
  4. var tcolour = '?#?ffffff?'; // background colour:
  5. var moStop = true; // pause on mouseover (true or false)
  6. var fontfamily = 'arial,sans-serif'; // font for content
  7. var tSpeed = 3; // scroll speed (1 = slow, 5 = fast)
  8. // enter your ticker content here (use \/ and \' in place of / and ' respectively)
  9. var content = 'Content comes here....';
  10. var cps = tSpeed;
  11. var aw, mq;
  12. var fsz = parseInt(tHeight) - 4;
  13.  
  14. function startticker() {
  15.     if (document.getElementById) {
  16.         var tick = '<div style="position:relative;width:' + tWidth + ';height:' + tHeight + ';overflow:hidden;background-color:' + tcolour + '"';
  17.        if (moStop) tick += ' onmouseover="cps=0" onmouseout="cps=tSpeed"';
  18.        tick += '><div id="mq" style="position:absolute;right:0px;top:0px;font-family:' + fontfamily + ';font-size:' + fsz + 'px;white-space:nowrap;"><\/div><\/div>';
  19.         document.getElementById('ticker').innerHTML = tick;
  20.         mq = document.getElementById("mq");
  21.         mq.innerHTML = '<span id="tx">' + content + '<\/span>';
  22.         aw = document.getElementById("tx").offsetWidth;
  23.         mq.style.right = "-" + (aw + 10) + "px";
  24.         lefttime = setInterval("scrollticker()", 50);
  25.     }
  26. }
  27.  
  28. function scrollticker() {
  29.     mq.style.right = (parseInt(mq.style.right) < (10 + parseInt(tWidth))) ?
  30.        mq.style.right = parseInt(mq.style.right) + cps + "px" : "-" + (aw + 10) + "px";
  31. }
  32. window.onload = startticker;
  33. </script>
  34. </head>
  35. <body>
  36. <div id="ticker">
  37. this is a simple scrolling text!
  38. </div>
  39. </body>
Advertisement
Add Comment
Please, Sign In to add comment