Closed Bug 1310540 Opened 9 years ago Closed 9 years ago

Javascript can't recognize document.form1.elements["some_"+n].value

Categories

(Firefox :: Untriaged, defect)

49 Branch
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: nomura, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0 Build ID: 20160802213348 Steps to reproduce: version 49.0.1 can't recognize the syntax document.form1.elements["some_"+0].value, while before 48.0.2 works fine. Actual results: <form name="form1" action="zzzz.phtml" method="post"> <input type="text" name="some_0" value="44"> var n=parseInt( document.form1.elements["some_"+0].value ); alert( "n="+n); it shows "n=NaN" Expected results: it should show "n=44"
Can you provide a standalone testcase?
Flags: needinfo?(nomura)
I'm sorry I found it is not a bug, but javascript's version problem. String.replace( exp, rep, "g" ) becomes obsolete. I changed it to String.replace( new RegExp( exp, "g"), rep ), and works correctly. Please close it.
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Flags: needinfo?(nomura)
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.