Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Change Css Overflow Prop With Javascript

CSS

  • Please log in to reply
1 reply to this topic

#1 JakeWelton

JakeWelton

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 152 posts
  • Programming Language:Java, C++, C#, PHP, JavaScript, PL/SQL
  • Learning:Objective-C, Python, Perl, Ruby, Visual Basic .NET, Haskell

Posted 25 July 2012 - 01:29 PM

Hello,

I was wondering how od i change the overflow-y and overflow-x prop of a div by using Javascript. I know you can change height and widths with javascript but im not sure how the overflow prop is changed.

Thanks,
Jake
  • 0

sig.jpg

"Before you judge someone, walk a mile in their shoes; after that, who cares?! Their a mile away and you've got their shoes!"


#2 RhetoricalRuvim

RhetoricalRuvim

    JavaScript Programmer

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1310 posts
  • Location:C:\Countries\US
  • Programming Language:C, Java, C++, PHP, Python, JavaScript

Posted 27 July 2012 - 09:43 AM

Have you tried <object>.style.overflowX= and <object>.style.overflowY= ?

Will this work?:
var txt= ... the element object ... 
txt.style.overflowY= "auto"; 
txt.style.height= "400px"; 

var i; 
for (i= 0; i < 100; i++){ 
  txt.appendTextNode ("Hello World!"); 
  txt.appendChild (document.createElement ("br")); 
}

  • 0
Regards,
RR





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download