Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-08-24
8
Medium Priority
?
398 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 375 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…

670 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