简体   繁体   English

将值存储在数组中并将该数组传递给js函数

[英]storing value in an array and passing that array to a js function

This is a code from my c# web application 这是我的C#Web应用程序中的代码

here [ Response.Write(match.Groups[1]); 这里[Response.Write(match.Groups [1]); ] i will get a display of string array in my screen ]我将在屏幕上显示字符串数组

i want to store this values in an array and have to pass that array to a javascript function 我想将此值存储在数组中,并且必须将该数组传递给javascript函数

and then have to take each values from that array. 然后必须从该数组中获取每个值。

below is my js function 下面是我的js函数

function openNewWindow() { //alert("hello"); 函数openNewWindow(){// alert(“ hello”); var theurl="http://www.gmail.com"; var theurl =“ http://www.gmail.com”; popupWin = window.open(theurl, '_blank', 'menubar, toolbar, location, directories, status, scrollbars, resizable, dependent, width=640, height=480, left=0, top=0') } popupWin = window.open(theurl,'_blank','菜单栏,工具栏,位置,目录,状态,滚动条,可调整大小,相关,宽度= 640,高度= 480,左= 0,顶部= 0')}

Actually that array will store some hyperlinks, eg: http://www.gmail.com , http://www.google.co.in etc. 实际上,该数组将存储一些超链接,例如: http : //www.gmail.com,http : //www.google.co.in等。

now i'm giving that hyperlinks manualy in the js variable [ theurl]. 现在,我在js变量[theurl]中手动给出了超链接。

i want to pass my array values to this variable... 我想将我的数组值传递给此变量...

can any one help me to do this. 谁能帮我做到这一点。

if anyone have a code please share it with me. 如果有人有密码,请与我分享。

Thanks 谢谢

Just concatenate all those urls with a special character (delimiter) and send that string to the JavaScript as a parameter. 只需使用特殊字符(定界符)将所有这些url连接起来,然后将该字符串作为参数发送到JavaScript。

In the JavaScript you can then split the string into urls and use them. 然后,您可以在JavaScript中将字符串拆分为url并使用它们。

Thanks 谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM