getselection() does not work inside input fields

VERIFIED DUPLICATE of bug 85686

Status

()

Core
JavaScript Engine
VERIFIED DUPLICATE of bug 85686
16 years ago
16 years ago

People

(Reporter: Thomas Forster, Assigned: rogerl (gone))

Tracking

Trunk
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment)

(Reporter)

Description

16 years ago
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de-AT; rv:1.0rc1)
Gecko/20020417
BuildID:    2002041711

Javascript method getselection() does not work inside input fiels (tested with
textarea and type='text').

Reproducible: Always
Steps to Reproduce:
1. load url with example
2. select text in the textarea

Actual Results:  nothing happens

Expected Results:  selected text should be displayed in right input field (works
with Internet Explorer)

This Javascript-function is used:

function showselected()
  {
   if (window.getSelection) show = window.getSelection(); // for Netscape 6
(doesn't work)
   else if (document.getSelection) show = document.getSelection(); // for
Netscape 4 (doesn't work)
        else if (document.selection) show =
document.selection.createRange().text; // for IE (works)
document.getElementById("text").value = show;
  }

Comment 1

16 years ago
Duplicate of bug 85686?

Comment 2

16 years ago

*** This bug has been marked as a duplicate of 85686 ***
Status: UNCONFIRMED → RESOLVED
Last Resolved: 16 years ago
Resolution: --- → DUPLICATE

Comment 3

16 years ago
Verified Duplicate.

Thomas, thank you for this report; you have been cc'ed on the other bug -
Status: RESOLVED → VERIFIED
(Reporter)

Comment 4

16 years ago
Created attachment 80635 [details]
Test Case
You need to log in before you can comment on or make changes to this bug.