Closed Bug 338801 Opened 19 years ago Closed 19 years ago

assign <input type=text> value to <div> inner text using javascript gives error

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 264412

People

(Reporter: engxladso, Unassigned)

References

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3 error msg: Error: [Exception... "'Permission denied to set property XULElement.selectedIndex' when calling method: [nsIAutoCompletePopup::selectedIndex]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "JS frame :: http://localhost/CachetHomewaresV3/cachet/AffiliateAdmin.asp :: ButtonText :: line 547" data: no] Source File: http://localhost/CachetHomewaresV3/cachet/AffiliateAdmin.asp Line: 547 Code Producing error: HTML: <p><input style="width:150px;" type='text' size='20' maxlength='50' name='blk7BtnText' id="blk7BtnText" value='Visit Catalogue' onKeyUp="javascript:ButtonText(this);"> </p> <div id="blk7Btn1" style="color:black;text-align:center;position:absolute;top:270px;left:0px;BACKGROUND-IMAGE:url(images/buttons/btn1.gif);BACKGROUND-REPEAT:no-repeat;width:77px;height:20px;line-height:18px;">Visit Catalogue</div> <div id="blk7Btn2" style="color:blue;text-align:center;position:absolute;top:270px;left:100px;BACKGROUND-IMAGE:url(images/buttons/btn2.gif);BACKGROUND-REPEAT:no-repeat;width:79px;height:22px;line-height:20px;">Visit Catalogue</div> <div id="blk7Btn3" style="color:white;text-align:center;position:absolute;top:273px;left:200px;BACKGROUND-IMAGE:url(images/buttons/btn3.gif);BACKGROUND-REPEAT:no-repeat;width:115px;height:18px;line-height:16px;">Visit Catalogue</div> <div id="blk7Btn10" style="color:blue;text-align:center;position:absolute;top:270px;left:325px;BACKGROUND-IMAGE:url(images/buttons/btn10.gif);BACKGROUND-REPEAT:no-repeat;width:126px;height:24px;line-height:22px;">Visit Catalogue</div> <div id="blk7Btn4" style="color:white;text-align:center;position:absolute;top:300px;left:0px;BACKGROUND-IMAGE:url(images/buttons/btn4.gif);BACKGROUND-REPEAT:no-repeat;width:141px;height:25px;line-height:23px;">Visit Catalogue</div> <div id="blk7Btn5" style="color:white;text-align:center;position:absolute;top:300px;left:150px;BACKGROUND-IMAGE:url(images/buttons/btn5.gif);BACKGROUND-REPEAT:no-repeat;width:135px;height:24px;line-height:22px;">Visit Catalogue</div> <div id="blk7Btn6" style="color:white;text-align:center;position:absolute;top:300px;left:300px;BACKGROUND-IMAGE:url(images/buttons/btn6.gif);BACKGROUND-REPEAT:no-repeat;width:144px;height:24px;line-height:22px;">Visit Catalogue</div> <div id="blk7Btn7" style="color:white;text-align:center;position:absolute;top:330px;left:0px;BACKGROUND-IMAGE:url(images/buttons/btn7.gif);BACKGROUND-REPEAT:no-repeat;width:113px;height:22px;line-height:20px;">Visit Catalogue</div> <div id="blk7Btn8" style="color:white;text-align:center;position:absolute;top:330px;left:150px;BACKGROUND-IMAGE:url(images/buttons/btn8.gif);BACKGROUND-REPEAT:no-repeat;width:112px;height:20px;line-height:18px;">Visit Catalogue</div> <div id="blk7Btn9" style="color:white;text-align:center;position:absolute;top:330px;left:300px;BACKGROUND-IMAGE:url(images/buttons/btn9.gif);BACKGROUND-REPEAT:no-repeat;width:124px;height:23px;line-height:21px;">Visit Catalogue</div> Javascript: function ButtonText(btnText) { for(var i=1;i<11;i++) { document.getElementById("blk7Btn"+i).innerText = btnText.value } } alerts for all elements works fine and prove that this assignment statement works. Problem seems to be in displaying new innerText on firefox page. Works in IE. Will try using innerHTML to get round. This is similar to the 'get' bugs I guess but I didn't see any other examples of this 'set' bug. This is very simple, normal javascript. It shouldn't be causing a problem. Would be interested to know the cause if anyone has time to email me. Reproducible: Always Steps to Reproduce: 1.type new text in the relevent text box 2. 3. Actual Results: no change is seen on the page and the error is generated in javascript console. Expected Results: text should be seen to change in all buttons
You should probably use innerHTML and not innerText (see http://www.quirksmode.org/dom/tests/innerhtml.html and http://www.mozilla.org/docs/web-developer/upgrade_2.html#dom_manip) For the error message, it's probably due to bug 236791
Depends on: 236791
*** This bug has been marked as a duplicate of 264412 ***
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.