Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Question

Commonmark migration
Source Link

I am working for some common method in javascript, for that i have to call array dynamically.

 var ddlText, ddlValue, ddl, lblMesg, ddlTextCacheList_Designation, ddlValueCacheList_Designation, ddlTextCacheList_Scale, ddlValueCacheList_Scale;
 function cacheDes() {
 
 var listDes = document.getElementById("<%=List_Designation.ClientID %>");
 ddlTextCacheList_Designation = new Array();
 ddlValueCacheList_Designation = new Array();
 for (var i = 0; i < listDes.options.length; i++) {
 ddlTextCacheList_Designation[ddlTextCacheList_Designation.length] = listDes.options[i].text;
 ddlValueCacheList_Designation[ddlValueCacheList_Designation.length] = listDes.options[i].value;
 }
 
 }
 function cacheScale() {
 var listScale = document.getElementById("<%=List_Scale.ClientID %>");
 ddlTextCacheList_Scale = new Array();
 ddlValueCacheList_Scale = new Array();
 for (var i = 0; i < listScale.options.length; i++) {
 ddlTextCacheList_Scale[ddlTextCacheList_Scale.length] = listScale.options[i].text;
 ddlValueCacheList_Scale[ddlValueCacheList_Scale.length] = listScale.options[i].value;
 }
 }
 window.onload = function () {
 cacheDes();
 cacheScale();
 };

I want to call array ddlTextCacheList_Scale or ddlTextCacheList_Designation for same method as we know 'ddlTextCacheList_' is common only we need to put 'Scale' or 'Designation' dynamicaaly by passing parameter.

Add:
I get some errors:
![enter image description here][1] [1]: https://i.sstatic.net/1ba05.pngenter image description here

I am working for some common method in javascript, for that i have to call array dynamically.

 var ddlText, ddlValue, ddl, lblMesg, ddlTextCacheList_Designation, ddlValueCacheList_Designation, ddlTextCacheList_Scale, ddlValueCacheList_Scale;
 function cacheDes() {
 
 var listDes = document.getElementById("<%=List_Designation.ClientID %>");
 ddlTextCacheList_Designation = new Array();
 ddlValueCacheList_Designation = new Array();
 for (var i = 0; i < listDes.options.length; i++) {
 ddlTextCacheList_Designation[ddlTextCacheList_Designation.length] = listDes.options[i].text;
 ddlValueCacheList_Designation[ddlValueCacheList_Designation.length] = listDes.options[i].value;
 }
 
 }
 function cacheScale() {
 var listScale = document.getElementById("<%=List_Scale.ClientID %>");
 ddlTextCacheList_Scale = new Array();
 ddlValueCacheList_Scale = new Array();
 for (var i = 0; i < listScale.options.length; i++) {
 ddlTextCacheList_Scale[ddlTextCacheList_Scale.length] = listScale.options[i].text;
 ddlValueCacheList_Scale[ddlValueCacheList_Scale.length] = listScale.options[i].value;
 }
 }
 window.onload = function () {
 cacheDes();
 cacheScale();
 };

I want to call array ddlTextCacheList_Scale or ddlTextCacheList_Designation for same method as we know 'ddlTextCacheList_' is common only we need to put 'Scale' or 'Designation' dynamicaaly by passing parameter.

Add:
I get some errors:
![enter image description here][1] [1]: https://i.sstatic.net/1ba05.png

I am working for some common method in javascript, for that i have to call array dynamically.

 var ddlText, ddlValue, ddl, lblMesg, ddlTextCacheList_Designation, ddlValueCacheList_Designation, ddlTextCacheList_Scale, ddlValueCacheList_Scale;
 function cacheDes() {
 
 var listDes = document.getElementById("<%=List_Designation.ClientID %>");
 ddlTextCacheList_Designation = new Array();
 ddlValueCacheList_Designation = new Array();
 for (var i = 0; i < listDes.options.length; i++) {
 ddlTextCacheList_Designation[ddlTextCacheList_Designation.length] = listDes.options[i].text;
 ddlValueCacheList_Designation[ddlValueCacheList_Designation.length] = listDes.options[i].value;
 }
 
 }
 function cacheScale() {
 var listScale = document.getElementById("<%=List_Scale.ClientID %>");
 ddlTextCacheList_Scale = new Array();
 ddlValueCacheList_Scale = new Array();
 for (var i = 0; i < listScale.options.length; i++) {
 ddlTextCacheList_Scale[ddlTextCacheList_Scale.length] = listScale.options[i].text;
 ddlValueCacheList_Scale[ddlValueCacheList_Scale.length] = listScale.options[i].value;
 }
 }
 window.onload = function () {
 cacheDes();
 cacheScale();
 };

I want to call array ddlTextCacheList_Scale or ddlTextCacheList_Designation for same method as we know 'ddlTextCacheList_' is common only we need to put 'Scale' or 'Designation' dynamicaaly by passing parameter.

Add:
I get some errors:
enter image description here

added 115 characters in body
Source Link
vp_arth
  • 15k
  • 4
  • 43
  • 72

I am working for some common method in javascript, for that i have to call array dynamically.

 var ddlText, ddlValue, ddl, lblMesg, ddlTextCacheList_Designation, ddlValueCacheList_Designation, ddlTextCacheList_Scale, ddlValueCacheList_Scale;
 function cacheDes() {
 
 var listDes = document.getElementById("<%=List_Designation.ClientID %>");
 ddlTextCacheList_Designation = new Array();
 ddlValueCacheList_Designation = new Array();
 for (var i = 0; i < listDes.options.length; i++) {
 ddlTextCacheList_Designation[ddlTextCacheList_Designation.length] = listDes.options[i].text;
 ddlValueCacheList_Designation[ddlValueCacheList_Designation.length] = listDes.options[i].value;
 }
 
 }
 function cacheScale() {
 var listScale = document.getElementById("<%=List_Scale.ClientID %>");
 ddlTextCacheList_Scale = new Array();
 ddlValueCacheList_Scale = new Array();
 for (var i = 0; i < listScale.options.length; i++) {
 ddlTextCacheList_Scale[ddlTextCacheList_Scale.length] = listScale.options[i].text;
 ddlValueCacheList_Scale[ddlValueCacheList_Scale.length] = listScale.options[i].value;
 }
 }
 window.onload = function () {
 cacheDes();
 cacheScale();
 };

I want to call array ddlTextCacheList_Scale or ddlTextCacheList_Designation for same method as we know 'ddlTextCacheList_' is common only we need to put 'Scale' or 'Designation' dynamicaaly by passing parameter.

Add:
I get some errors:
![enter image description here][1] [1]: https://i.sstatic.net/1ba05.png

I am working for some common method in javascript, for that i have to call array dynamically.

 var ddlText, ddlValue, ddl, lblMesg, ddlTextCacheList_Designation, ddlValueCacheList_Designation, ddlTextCacheList_Scale, ddlValueCacheList_Scale;
 function cacheDes() {
 
 var listDes = document.getElementById("<%=List_Designation.ClientID %>");
 ddlTextCacheList_Designation = new Array();
 ddlValueCacheList_Designation = new Array();
 for (var i = 0; i < listDes.options.length; i++) {
 ddlTextCacheList_Designation[ddlTextCacheList_Designation.length] = listDes.options[i].text;
 ddlValueCacheList_Designation[ddlValueCacheList_Designation.length] = listDes.options[i].value;
 }
 
 }
 function cacheScale() {
 var listScale = document.getElementById("<%=List_Scale.ClientID %>");
 ddlTextCacheList_Scale = new Array();
 ddlValueCacheList_Scale = new Array();
 for (var i = 0; i < listScale.options.length; i++) {
 ddlTextCacheList_Scale[ddlTextCacheList_Scale.length] = listScale.options[i].text;
 ddlValueCacheList_Scale[ddlValueCacheList_Scale.length] = listScale.options[i].value;
 }
 }
 window.onload = function () {
 cacheDes();
 cacheScale();
 };

I want to call array ddlTextCacheList_Scale or ddlTextCacheList_Designation for same method as we know 'ddlTextCacheList_' is common only we need to put 'Scale' or 'Designation' dynamicaaly by passing parameter.

I am working for some common method in javascript, for that i have to call array dynamically.

 var ddlText, ddlValue, ddl, lblMesg, ddlTextCacheList_Designation, ddlValueCacheList_Designation, ddlTextCacheList_Scale, ddlValueCacheList_Scale;
 function cacheDes() {
 
 var listDes = document.getElementById("<%=List_Designation.ClientID %>");
 ddlTextCacheList_Designation = new Array();
 ddlValueCacheList_Designation = new Array();
 for (var i = 0; i < listDes.options.length; i++) {
 ddlTextCacheList_Designation[ddlTextCacheList_Designation.length] = listDes.options[i].text;
 ddlValueCacheList_Designation[ddlValueCacheList_Designation.length] = listDes.options[i].value;
 }
 
 }
 function cacheScale() {
 var listScale = document.getElementById("<%=List_Scale.ClientID %>");
 ddlTextCacheList_Scale = new Array();
 ddlValueCacheList_Scale = new Array();
 for (var i = 0; i < listScale.options.length; i++) {
 ddlTextCacheList_Scale[ddlTextCacheList_Scale.length] = listScale.options[i].text;
 ddlValueCacheList_Scale[ddlValueCacheList_Scale.length] = listScale.options[i].value;
 }
 }
 window.onload = function () {
 cacheDes();
 cacheScale();
 };

I want to call array ddlTextCacheList_Scale or ddlTextCacheList_Designation for same method as we know 'ddlTextCacheList_' is common only we need to put 'Scale' or 'Designation' dynamicaaly by passing parameter.

Add:
I get some errors:
![enter image description here][1] [1]: https://i.sstatic.net/1ba05.png

Source Link
Sonam Mohite
  • 903
  • 4
  • 20
  • 58

How to change array variable name dynamically

I am working for some common method in javascript, for that i have to call array dynamically.

 var ddlText, ddlValue, ddl, lblMesg, ddlTextCacheList_Designation, ddlValueCacheList_Designation, ddlTextCacheList_Scale, ddlValueCacheList_Scale;
 function cacheDes() {
 
 var listDes = document.getElementById("<%=List_Designation.ClientID %>");
 ddlTextCacheList_Designation = new Array();
 ddlValueCacheList_Designation = new Array();
 for (var i = 0; i < listDes.options.length; i++) {
 ddlTextCacheList_Designation[ddlTextCacheList_Designation.length] = listDes.options[i].text;
 ddlValueCacheList_Designation[ddlValueCacheList_Designation.length] = listDes.options[i].value;
 }
 
 }
 function cacheScale() {
 var listScale = document.getElementById("<%=List_Scale.ClientID %>");
 ddlTextCacheList_Scale = new Array();
 ddlValueCacheList_Scale = new Array();
 for (var i = 0; i < listScale.options.length; i++) {
 ddlTextCacheList_Scale[ddlTextCacheList_Scale.length] = listScale.options[i].text;
 ddlValueCacheList_Scale[ddlValueCacheList_Scale.length] = listScale.options[i].value;
 }
 }
 window.onload = function () {
 cacheDes();
 cacheScale();
 };

I want to call array ddlTextCacheList_Scale or ddlTextCacheList_Designation for same method as we know 'ddlTextCacheList_' is common only we need to put 'Scale' or 'Designation' dynamicaaly by passing parameter.

lang-js

AltStyle によって変換されたページ (->オリジナル) /