473,789 Members | 2,293 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

textarea in a popped window

The following javascript code (used as a bookmarklet) is supposed to
pop a window containig a "textarea".
javascript:(
function()
{

var nd =
window.open('', '','directories =yes,left=0,wid th=600,height=3 00').document;

var box = nd.createElemen t('textarea');

box.setAttribut e('rows','15');

box.setAttribut e('cols','50');

nd.body.appendC hild(box);

}
)()

It works fine in FireFox. On IE, the window is popped, but without the
textarea. What could be the reason?

Appreciate any help.

--Jess

Oct 19 '05 #1
4 2103
my guess (since i don't have id) is that you aren't naming the new
window. try something like

var
win=window.open ('','','directo ries=yes,left=0 ,width=600,heig ht=300');
var nd=win.document

then use your code as you have it. you might also try replacing
nd.body.appendC hild with
nd.getElementsB yTagName('body' )[0]
because I am not sure if IE has a document.body variable, though I may
be wrong on this count too. Worth a shot though.

Oct 20 '05 #2
je******@gmail. com said the following on 10/19/2005 7:40 PM:
The following javascript code (used as a bookmarklet) is supposed to
pop a window containig a "textarea".
javascript:(
function()
{

var nd =
window.open('', '','directories =yes,left=0,wid th=600,height=3 00').document;

var box = nd.createElemen t('textarea');

box.setAttribut e('rows','15');
box.rows = '15';
box.setAttribut e('cols','50');


box.cols = '50';

IE is notorious not to have support for setAttribute, access the
property directly.

All on one line of course:
javascript:(fun ction(){var
nd=window.open( '','','director ies=yes,left=0, width=600,heigh t=300').documen t;var
box=nd.createEl ement('textarea ');box.rows='15 0';box.cols='50 ';nd.body.appen dChild(box);})( )

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Oct 20 '05 #3
Joshie Surber said the following on 10/19/2005 9:39 PM:
my guess (since i don't have id) is that you aren't naming the new
window. try something like
Re-read the code. It has a reference to the new window and its document.
var
win=window.open ('','','directo ries=yes,left=0 ,width=600,heig ht=300');
var nd=win.document

then use your code as you have it. you might also try replacing
nd.body.appendC hild with
nd.getElementsB yTagName('body' )[0]
Neither will cause it to work "properly" as IE has a lack of support for
setAttribute
because I am not sure if IE has a document.body variable, though I may
be wrong on this count too.


Yes, IE has a document.body

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Answer: Google Users who don't quote.
Question: What's even worse?
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
Oct 20 '05 #4
McA
> var box = nd.createElemen t('textarea');
box.setAttribut e('rows','15');
box.setAttribut e('cols','50');
nd.body.appendC hild(box);


You must create textarea inside of form element:

window.onload=f unction(){

var nd =
window.open('', '','directories =yes,left=0,wid th=600,height=3 00').document;
var frm = nd.createElemen t('form');
var box = nd.createElemen t('textarea');

box.setAttribut e('rows','15');

box.setAttribut e('cols','50');

frmEl=nd.body.a ppendChild(frm) ;
frmEl.appendChi ld(box);

}
Oct 20 '05 #5

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

Similar topics

4
10219
by: David | last post by:
It's sad to say, but when using the AOL web site, like to send an email, they have a nifty capability such that when a window is resized, the textarea where the message is input expands not only horizontally, but also vertically, to fill the space. I took a look at their javascripts, but they are quite complex and convoluted since they make use of many of their own functions designed to work with their web site. Does anybody have a...
6
1854
by: dan glenn | last post by:
hi. I'm having a problem using javasript to pass the value of a textarea (in a form) to a PHP script file. I want to code a 'preview' function into a guestbook entry page, using an HTML link with some javascript to grab the form's textarea value, and open another browser window that uses a php file that applies all the styles, etc. to the contents of what was in the text area (the guestbook entries allow simple HTML) and show the preview...
0
2362
by: Krzysztof Fink-Finowicki via .NET 247 | last post by:
I have problem with TEXTAREA HTML tags in my Web application (MSIE 6.0). User fills-in content of TEXTAREA on HTML dialog window. After accepting, content of TEXTAREA from dialog window is copiedto TEXTAREA on main HTML window: wndTxtArea.value = dlgTxtArea.value; Then user may take the text for editing in HTML dialog windowonce more. The problem arises when text to be copied is multiline. Firsttime it is displayed properly after...
4
11213
by: Steve | last post by:
Hi, I'm opening a small window with window.open. I have a textarea there, and I want it to expand to fit the window as it's resized. How is this possible? Thanks, Steve
5
12157
by: Jesper Rønn-Jensen | last post by:
I have a textarea that must be limited to 70 characters. No big deal -- at least so I thought. * Textarea must not exceed 70 characters * Exceeding content must be cut off * Must work on input by keyboard (keypress, keyup events) * Must work on pasted input from context menu * Must work on pasted input via CTRL+V and similar * Must work on pasted input via browsers menu>Edit>Paste * Must work in Mozilla + IE and coded via W3C standards
1
2773
by: trihanhcie | last post by:
Hi I have several textarea in the same page. I would like to count the words in each textarea without any interaction with each other. Here's the code I used for the count : <script type="text/javascript"> /*Téléchargé sur Easy-Script.com (http://www.easy-script.com) Trouvé sur: www.portugal-tchat.com */
4
7807
by: Keith Bentrup | last post by:
Hi all, I wrote a simple search function to find text in a textarea where not all the text is visible (ie. the text box displays 10 lines but there may be more than 1000 lines to search). I can find the text and select it using the function below, BUT I can't figure out how to have the textarea automatically scroll to the selection in Firefox. Any ideas or suggestions? function search(needle,haystack,start) { var element =...
0
2875
by: korggrok | last post by:
I have a dialog window that pops up from the main app browser window. The window contains a form (name="savechanges") that includes an input (name="sql") that is a textarea input. The dialog window includes a button: <INPUT TYPE=SUBMIT VALUE="Test SQL" OnClick="javascript:openWin3('/cgi- bin/eisweb.exe? uni=67BD&action=TestSQL&viewname=EISWEB_TESTSQL.SQL&forceregen=true&sql='+savechanges.sql.value);return false;">
5
2932
by: sunadumari | last post by:
Hi folks, hope I'm in the wright section (I'm a newbie). I've got a textarea that, with the click on a button, shows the html-look of the data in the textarea. This script I found on the net (with author source ). Now I've added the option to make text in BOLD etc (code found on this forum), BUT it doesn't work.... This is the code (within a php file): <div align="center"> <table style="width:600px;border:solid 1px...
0
9656
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
9502
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
10386
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10182
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...
1
10131
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9973
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
9003
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...
0
5407
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2899
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.