473,778 Members | 1,934 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

resize textarea on Safari

The following script is intended to grow the textarea
when the user first gives it focus. This seems to work
on most browsers, but does nothing on Safari on the Mac
(the rows and columns are updated internally, but the
textarea does not expand onscreen).

Any ideas why it doesn't work, or if there are any
workarounds?

Thanks
Mark

<html>
<body>
<script>
function expandpost(t) {
t.rows = 6;
t.cols = 60;
}
</script>
<textarea name=comments cols=40 rows=2
onFocus="javasc ript:expandpost (this);">blah
</textarea>
</body>
</html>
Jul 20 '05 #1
1 5089
I am working around the same problem. The rows and cols attributes in
Safari only affect the actual rows and cols inside the textarea, rather
than affecting the viewable area.

For your needs, you can simply use my first solution. Just put:

if ([test for safari]) {
t.outerHTML = '<textarea name=comments cols=60 rows=6></textarea>';
}

*Should* work. Unfortunately for me, I am trying to resize the textarea
on the fly, and this causes the browser to loose focus of the textarea.

I am also trying to figure out how to get a textarea to accept the border:
none; style, and kill the glowing focus around the textarea. Anyone know
anything about this in Safari?

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4131
by: Mike Labman | last post by:
This is more of an HTML/CSS question, but I figure someone in here might know. I'm using in the stylesheet: BORDER-RIGHT: none; BORDER-TOP: none; BORDER-LEFT: none; BORDER-BOTTOM: none; OVERFLOW: hidden;
2
15487
by: bdwise | last post by:
Can anyone recommend a way to dynamically resize a textarea? I already have it inside a <div> for positioning on a page, but I would like to have the textarea always fill the div so I can resize according to the div as well. Or any other option. Thanks.
2
11237
by: Mark Szlazak | last post by:
The following code fails in Firefox to get at selected text in the right-side textarea. Any help would be appreciated. <html> <head> <script> var agt = navigator.userAgent.toLowerCase(); var safari = ((agt.indexOf('safari') != -1) && (agt.indexOf('mac') != -1))? true:false; var opera = (window.opera)? true:false;
1
2395
by: Gernot Frisch | last post by:
Hi, I want to be able to select 3 rows of a textarea, and when pressing "Tab/shift Tab" indent the source code edited. Can I do this with JavaScript? -- -Gernot int main(int argc, char** argv) {printf
1
3710
by: petermichaux | last post by:
Hi, I have been experimenting with some textarea automatic resize scripts. Most that I have found count the number of characters in the textarea and divide by the number of columns. This works will with monospaced fonts or with just wide letters like 'M'. However if I fill the text area with proportional font 'i' characters then a lot of white space builds up at the end of the text area. Is there a way to account for proportional fonts...
2
19585
by: xhe | last post by:
I met a very headache problem in javascript, I think this might be difference between IE and NS / Safari. I have a text area <form> <textarea name='tex1' onkeyup='displayit();'></textarea> </form> <span id="txtValue"></span> <script language='javascript'>
3
4942
by: MikeK | last post by:
Ok, I've been noodling with this for several days now and I'm starting to go crazy. Does Apple's Safari browser support drag events on Textarea elements? The few specs and docs I've found seem to indicate that it does but I can't get it to work for the life of me. I've tired everything I can think of to try get notifications for the events: ondragenter ondragleave ondragover ondrop
4
4013
by: fredsterss | last post by:
Hello all, built a simple site using a CMS combining MySQL for the back end and PHP to display it all. I have an admin page that has a form comprising of several textareas so the client can update the contents of the site himself. Any formatting - eg. user line breaks - is inserted into the database and works a-ok. However, when using Safari (I'm running OS X 10.5.1 and Safari 3.0.4), all the line-ends - ie. where the text wraps in the...
0
9629
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9465
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10127
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9923
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8954
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7474
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5497
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3627
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2863
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.