Jump to content


textarea.value='X' Not working in Firefox

  • Please log in to reply
3 replies to this topic

#1 anonnerz

  • Members
  • Pip
  • Newbie
  • 7 posts

Posted 11 July 2006 - 02:39 AM

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:
function set(toset, img, iid, thelink) {
	link = thelink;
	do_id = iid;
	document.main.src = img + '&x=300&y=300';
	Image_Desc.value = toset;

The image setting it (it's an onmousedown... as you can see)
 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')" >

The textarea:
<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>

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

#2 anonnerz

  • Members
  • Pip
  • Newbie
  • 7 posts

Posted 11 July 2006 - 04:23 AM

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

#3 Daniel0

  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 11 July 2006 - 04:01 PM

You can also use the id tag along with the javascript function getelementbyid()

#4 obsidian

  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 11 July 2006 - 04:13 PM

they underlying problem is that the textarea has no value property, so you're better off to use the innerHTML attribute instead.
You can't win, you can't lose, you can't break even... you can't even get out of the game.

while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users