SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Addict
    Join Date
    Aug 2006
    Posts
    266
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    when a user pressed a key without stopping

    How can I get a horizontal scrollbar is not exist in its whenever a user enter text in textarea.
    What can I do if a user continuously presses to a particular button.

    I don't want a horizontal scroll bar.
    Internet Explorer is cutting long word and wrapping to next row. But Mozilla and Opera are not doing this. I have no problem in Internet Explorer. A horizontal scrollbar is absent in Internet Explorer. I don't want horizontal scrollbar in Mozilla and Opera?
    Last edited by muazzez; Dec 27, 2006 at 07:44.

  2. #2
    SitePoint Addict Procode's Avatar
    Join Date
    Dec 2006
    Location
    New York
    Posts
    371
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can just set the size of it.

  3. #3
    SitePoint Addict
    Join Date
    Aug 2006
    Posts
    266
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I try
    Code:
    <textarea cols="15" rows="10">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</textarea>
    A horizontal scrollbar is exist in Mozilla and Opera.

    It will not have to a horizontal scrollbar whenever a user enter text in textarea. How can I do this?
    Last edited by muazzez; Dec 27, 2006 at 07:48.

  4. #4
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To remove scrollbars, give it "overflow:hidden" in its CSS.

    It seems that Opera and Firefox will not wrap unless there's a space (they will not break words). IE will wrap even without spaces (it will break words).

  5. #5
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is also overflow-x and overflow-y that can be set. Don't know about the browser support, but IE and Firefox supports it.

  6. #6
    SitePoint Addict
    Join Date
    Aug 2006
    Posts
    266
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I did not explain what I wanted.
    I have this code.
    Code:
    <textarea rows="10" cols="15">ThisWordIsNotLessThan15Character</textarea>
    With Javascript, a code will be written. If a word is not less than 15 character, reminder will go to next row.

    It will be

    ThisWordIsNotLe
    ssThan15Charact
    er

    or
    It will be written in <div> </div>

    <div>
    ThisWordIsNotLe
    ssThan15Charact
    er
    </div>

    I wrote the following code. It works in İnternet Explorer as I wanted. I need it does this in Mozilla and Opera
    Code:
      
    <script type="text/javascript">
    
    function writeInDiv () {
    
    var e = document.getElementById('t');
    var e2 = document.getElementById('d');
    
    e2.innerHTML = e.value;
    }
    </script>
    
    <style type="text/css">
    .div { position:relative; left:20px; top:20px; width:105px; height:200px; 
    
       white-space: pre-wrap;      /* css-3                  */
       white-space: -moz-pre-wrap; /* Mozilla, since 1999    */
       white-space: -pre-wrap;     /* Opera 4-6              */
       white-space: -o-pre-wrap;   /* Opera 7                */
       word-wrap: break-word;      /* Internet Explorer 5.5+ */
    }
    </style>
    <button  onclick="writeInDiv ()">click me</button>
    <textarea id="t" rows="10" cols="15">ThisWordIsNotLessThan15Character</textarea>
    
    <div id="d" class="div"></div>
    I wrote this
    Code:
      
    <script type="text/javascript">
    
    function writeInDiv () {
    
    var e = document.getElementById('t');
    var e2 = document.getElementById('d');
    
    var a = e.value.substring(0,14) ;
    var b = e.value.substring(14,28) ;
    var c = e.value.substring(28) ;
    
    e2.innerHTML = a +"<br>"+b+ "<br>"+c;
    
    }
    </script>
    
    <button  onclick="writeInDiv ()">click me</button>
    <textarea id="t" rows="10" cols="15">ThisWordIsNotLessThan15Character</textarea>
    
    <div id="d" class="div"></div>
    The following code is working in Mozilla. In Opera, it is not working as I expected.
    Code:
     
    <script type="text/javascript">
    
    function writeInTextarea () {
    
    var e = document.getElementById('t');
    var e2 = document.getElementById('d');
    
    var a = e.value.substring(0,14) ;
    var b = e.value.substring(14,28) ;
    var c = e.value.substring(28) ;
    
    e.innerHTML = a +"\n"+b+ "\n"+c;
    
    }
    </script>
    
    <button  onclick="writeInTextarea ()">click me</button>
    <textarea id="t" rows="10" cols="15">ThisWordIsNotLessThan15Character</textarea>
    
    <div id="d" class="div"></div>
    I want to do this with loop. I changed my page.
    Code:
      
    <script type="text/javascript">
    
    function yaz () {
    
    var e = document.getElementById('t');
    
    var e2 = document.getElementById('d');
    
    for(i=0; i < e.value.length; i+=10 ) {
    
    e2.innerHTML = e2.innerHTML + e.value.substring(i, i+10) + "<br>" ;
    }
    }
    </script>
    
    <button  onclick="yaz ()">click me</button>
    
    <textarea id="t" rows="10" cols="15">ThisWordIsNotLessThan15Character</textarea>
    
    <div id="d" ></div>
    Last edited by muazzez; Feb 4, 2007 at 14:06.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •