Few Tips on Javascript

A few tips for copying text to clipboard and how to use buttons like forward and backward like  in browser and changes color of scrollbar.

1. If you want a  page to have a forward and backward button to navigate forward and backward (similar to basic functionality of a web browser) you can use the following code.

    
 

2. If you don’t want to allow the user  to select the text and  right click to copy selected text in controls like textarea or textbox,then  can you put a link or button control and call a javascript function to programatically copy the text to clipboard.

function sendToClipboard()
   {
     var textboxText = document.getElementById("txtText").value; //txtText id of a textbox
      if( window.clipboardData && clipboardData.setData )
      {
         clipboardData.setData("Text", textboxText );
      }
      else
      {
         alert("Internet Explorer required");//works only in IE4+
      }
   }

3.To Highlight the text inside a control

  document.getElementById(“txtText”).select(); //txtText id of a textbox

4. Changes the color of scrollbar and it will work in IE5+ .
put this class inside HEAD Tag.

HTML{
  scrollbar-face-color:#75EA00;
  scrollbar-arrow-color:brown;
  scrollbar-track-color:#EEEEEE;
  scrollbar-shadow-color:'';
  scrollbar-highlight-color:'';
  scrollbar-3dlight-color:'';
  scrollbar-darkshadow-Color:'';
      }

Note: Don’t  put a dot symbol before css class name means don’t use like.HTML .

5.Using CSS to change the cursor by an image. The image type must be .curor .ani type to implement this.


BODY{
cursor:url("crosshair.cur");
}

150 150 Burnignorance | Where Minds Meet And Sparks Fly!