How can you control the showing of the scrollbars from JavaScript for a TEXTAREA?

John Zukowski

The scrollbar setting is done by setting the CSS 'overflow' attribute of the text area. Here's an example:

<SCRIPT language=JavaScript>
function setOverflow(field, setting) {
    field.style.overflow = setting;
}
</SCRIPT>

<form name="foo">
  <textarea name="ta" rows="2" cols="20">
  </textarea>
</form>

<SELECT onchange="setOverflow(foo.ta,
    this.options[this.selectedIndex].text)">
<OPTION SELECTED>visible
<OPTION>scroll
<OPTION>hidden
<OPTION>auto
</SELECT>
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact