The key summary of using El Expression in JS: Use El expression in JS to be sure to add double quotes
The EL expression is used in JS control, and the source code is as follows:
Java code
- var selected = ${requestscope.xxxxform.recordnumperpage}
This always JS error, because requestScope.xxxxForm.recordNumPerPage is null at the first time. So under the boss's guidance, simply add two quotes, the code into Java code
- var selected = "${requestscope.xxxxform.recordnumperpage}"
OK, the function is automatically implemented.
Attach the entire function code: Java code
- function getselected (name) {
- var selects = document.getelementsbyname (name);
- var selected = "${requestscope.xxxxform.recordnumperpage}";
- if (selected = = Undefined | | selected = = Null | | selected = ="") {
- return false;
- }
- For (var j = 0; j < Selects.length; J + +) {
- For (var i = 0; i = selects[j].length; i++) {
- if (selects[j].options[i].value = = selected) {
- SELECTS[J].OPTIONS[I].SELECTD = true;
- }
- }
- }
- }
Key Summary: Use EL expression in JS must use double quotation marks
The key summary of using El Expression in JS: Use El expression in JS to be sure to add double quotes