开发者

pass javascript filename in a string?

开发者 https://www.devze.com 2023-03-11 18:10 出处:网络
I have many JS object literal files in my code. In a JS function data=data9.webb9[i]; I am accesin开发者_StackOverflow社区g it in this way

I have many JS object literal files in my code. In a JS function

data=data9.webb9[i];

I am accesin开发者_StackOverflow社区g it in this way with help of

script type="text/javascript" src="webdata"> script

in head tag

How could I

do something like this:

data=file[i];

where file=data9.web9 or data10.web10 and so on... according to function call.


switch( SomeFunction() )
{
case 1:
    file = data9.web9;
    break;
case 2:
    file = data10web10;
    break;
default:
    file = data.web;
}

data = file[i]; //file=data9.web9 or data10.web10 and so on... according to function call.

0

精彩评论

暂无评论...
验证码 换一张
取 消