Solved

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

Posted on 2004-08-24
8
385 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
  • 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Lazy load not working with masonry js 1 20
jQuery delay animation 3 30
Decoding Special HTML Characters using Javascript? 2 29
Html Table looping 4 13
Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
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…

809 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