Solved

Dynamically changing textarea cols and rows - working in Mozilla but not IE - Why?

Posted on 2004-08-24
8
391 Views
Last Modified: 2008-03-17
I have a app where I can expand/collapse a sidebar (of portal like blocks) to allow more area in the center for the main application. When I collapse the left side, I'd like to change the textarea size of the form since there is now more room.

In my toggleleftblocks function I have this which works in Mozilla (XP) but not in IE 6. No Error just don't get any change in IE

                        document.frm_edit.content.cols=100;

Is there a better way to do this?

0
Comment
Question by:Bl248
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 33

Accepted Solution

by:
knightEknight earned 125 total points
ID: 11880903
this works for me in IE6:

<HTML>
<HEAD>
<SCRIPT language='javascript'>

 function onLoadHandler()
 {
   alert("before: " + document.myform.myTextArea.cols);
   document.myform.myTextArea.cols=11;
   alert("after: " + document.myform.myTextArea.cols);
 }

</script>
</head>

<BODY onload="onLoadHandler();">

<FORM name='myform' onSubmit='return false;'>

  <TEXTAREA name="myTextArea"></textarea>

</form>

</body>
</html>
0
 
LVL 4

Expert Comment

by:MrClean21
ID: 11880906
Hi,

You can use the style or even a CSS like :

document.getElementById("frm_edit").style.width="200px";

or

document.getElementById("frm_edit").className="wideArea";

Hope this help
MrClean
0
 
LVL 4

Expert Comment

by:MrClean21
ID: 11880921
Sorry, mistake on the field name should read

document.getElementById("content").style.width="200px";

or

document.getElementById("content").className="wideArea";

MrClean
0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
LVL 33

Expert Comment

by:knightEknight
ID: 11880923
... previous code also works with specifed rows/cols:

  <TEXTAREA name="myTextArea" rows=10 cols=16></textarea>
0
 

Author Comment

by:Bl248
ID: 11881218
Hum .. something is odd then with my IE browser.

This works as well in Mozilla/Firefox on my XP desktop but does nothing in IE.
I removed the cols and rows settings in the textarea form field and Mozilla sets the textarea based on the CSS but IE just shows a default litte textarea.

#content {
    background-color: #ff6790;
      vertical-align:top;
      width:600px;
      height:400px;
}
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 11881254
did you close your </form> tag around the text area?
could be any number of little things like that ...
0
 

Author Comment

by:Bl248
ID: 11881257
Wait .. I know what it is ....    Doh!!

I have the HTMLArea Editor loading on IE for that teaxtarea field -- does not show on Mozilla.

I really would like the Editor to be used since my target users are all business desktops and specifying IE is not an issue.

I think I'll need to post this as a new question then unless you fine folks know if it is possible to resize this field if the HTMLArea Editor is being used.
0
 

Author Comment

by:Bl248
ID: 11882450
Thanks guys for your quick replies .. you confirmed that I was had the right idea. It was HTMLArea that was the issue with IE and by setting it's setting for width to 100% it will scale but the height will not change. Thats ok for my application.

I was reading on their site that ohers have asked for a way to refresh the component and that its an iframe I believe but there was no posted solution.  For me -- I'm ok with just the width adjusting as it does if I use config.width=100% in the setup.

I guess in this case - points go to knight as he replied first to confirm that it should work but I appreciate MrClean jumping in quickly as well.
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question