Jump to content

Archived

This topic is now archived and is closed to further replies.

anonnerz

textarea.value='X' Not working in Firefox

Recommended Posts

I've been trying for ages to be able to set textarea values in firefox to no avail. It just doesn't register the textarea... Any help?

Here is the relevant codes:

From the javascript file:
[code]function set(toset, img, iid, thelink) {
link = thelink;
do_id = iid;
document.main.src = img + '&x=300&y=300';
Image_Desc.value = toset;
}[/code]

The image setting it (it's an onmousedown... as you can see)
[code]
onMouseDown="
set('{$this->sql_fetch[desc]}', 'image_resize.php?src=uploads/{$this->sql_fetch[File]}', '{$this->sql_fetch[id]}', 'uploads/{$this->sql_fetch[File]}');
setCookie('page_{$this->sql_fetch[Item_ID]}','{$this->sql_fetch[File]}', '6');
setCookie('page_{$this->sql_fetch[Item_ID]}_desc', '{$this->sql_fetch[desc]}', '6');
setCookie('page_{$this->sql_fetch[Item_ID]}_x','300', '6');  setCookie('page_{$this->sql_fetch[Item_ID]}_y','220', '6');
setCookie('page_{$this->sql_fetch[Item_ID]}_link','uploads/{$this->sql_fetch[File]}', '6')" >
[/code]

The textarea:
[code]
<textarea name="Image_Desc" cols="30" readonly align=left style='height: 200px;'><?if (file_exists('Uploads/'.$_COOKIE[$cookie])) { echo stripslashes($_COOKIE['page_'.$_GET[id].'_desc']); } else if(!file_exists('Uploads/'.$_COOKIE[$cookie])) { echo $Pic_Viewer->first_image[desc]; } ?></textarea>





[/code]


It all works in IE but firefox doesn't like it. Any ideas?

Share this post


Link to post
Share on other sites
Thanks for looking if you came, fixed it.

For others with similar problem you have to put the text area in a form and refer to that form via document.form.textarea.value (with relevant values supplementing form and textarea of course).

Thanks =D

Share this post


Link to post
Share on other sites
You can also use the id tag along with the javascript function getelementbyid()

Share this post


Link to post
Share on other sites
they underlying problem is that the textarea has no value property, so you're better off to use the innerHTML attribute instead.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.