Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/408.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 将参数传递给不同页面中的js函数_Javascript_Asp.net_Web Applications_C# 2.0 - Fatal编程技术网

Javascript 将参数传递给不同页面中的js函数

Javascript 将参数传递给不同页面中的js函数,javascript,asp.net,web-applications,c#-2.0,Javascript,Asp.net,Web Applications,C# 2.0,我有一个带有下拉列表的aspx页面。当进行选择时,我需要将所选值传递给另一个页面中的javascript函数。第二个页面使用javascript显示地图: <script> var map; var ServiceName = "http://some_url//this_is_dynamic_part/MapServer .... </script> var映射; var ServiceName=”http://some_url//this_

我有一个带有下拉列表的aspx页面。当进行选择时,我需要将所选值传递给另一个页面中的javascript函数。第二个页面使用javascript显示地图:

<script>
    var map;
    var ServiceName = "http://some_url//this_is_dynamic_part/MapServer
    ....
</script>

var映射;
var ServiceName=”http://some_url//this_is_dynamic_part/MapServer
....

因此,从page1.aspx开始,我需要在一个新窗口中打开此页面,并传递一个参数(即下拉菜单的选定值)以替换变量ServiceName的“this_is_dynamic_part”。

我将在此处使用一个查询参数。在选择处理程序中,当构建要传递到
window.open()的URL时
,追加
?key=value
,其中
value
是要传递的值,
key
是某个参数名(任意)

然后,您的第二个页面可以引用
位置中页面参数的值。搜索

查看我在中使用的答案。我将查询字符串传递到第二个页面(Response.Redirect(“secondpage.html?cid=abcd”,其中“abcd”是下拉列表的选定值);在secondpage.html中将函数添加到pasre/get查询字符串值,并将“this_is_dynamic_part”变量的值设置为查询字符串中的值(“abcd”)。