将数组列表值从一个 JavaScript 传递到另一个 JavaScript

发布于 2024-12-21 15:36:36 字数 1974 浏览 0 评论 0原文

我有一个值的数组列表,必须从一个 html (javascript) 传递到另一个。

我的代码是:

function show_confirm()  
{  
     //var r=confirm("Do you wish to use the existing Details?");
     apprise('Do you wish to use the existing details?', {'verify':true}, function(r)  
                {  
                if(r)  
                    {   
                    // user clicked 'Yes'  
                alert("yes");  
                var a=camera.getDetails();  
                //window.locaton="http://www.google.co.in/";  
                var s=a.get(0);  
                alert(s);  
                //alert("rettttttttt" + a);  
                window.location="my_details.html?" + s;  
               //document.getElementById("location").value=a.get(0) + " ";  

                //alert(a.get(0) + " ");  
                //fetch my details from native  

                   }  
                else  
                  { 
                   // user clicked 'No'  
                  // display new form  
                 alert("no");  
                    }  
                });  

 }  
 </script>  

在 my_details.html 中:

 function submitForm(){  

     //var policyNumber=document.getElementById("number").value;
    //var a=camera.getDetails();
     var q=window.location.search;  
     if (q.substring(0, 1) == '?') {  
         q = query.substring(1);  
     }  
       alert("qqqqqqqqqq "+ q);  
 </script>   

如何在脚本之间传递数据?

我通过以下方式解决了这个问题:

 var c=new Array(a);    (eg: a={"1","2"})
 window.location="my_details.html?"+  c + "_";     

在 my_details.html 中:

var q=window.location.search;   
alert("qqqqqqqqqqqqq " + q);  
var arrayList = (q)? q.substring(1).split("_"):[];     
var list=new Array(arrayList);  
 alert("dataaaaaaaaaaaa " +  list  + "llll " ); 

在“list”中,它显示了我“1%202”;

我怎样才能删除这个 %20 =space 值?

谢谢
斯内哈

I have an arraylist of values which must be passed from one html (javascript) to another.

My code is :

function show_confirm()  
{  
     //var r=confirm("Do you wish to use the existing Details?");
     apprise('Do you wish to use the existing details?', {'verify':true}, function(r)  
                {  
                if(r)  
                    {   
                    // user clicked 'Yes'  
                alert("yes");  
                var a=camera.getDetails();  
                //window.locaton="http://www.google.co.in/";  
                var s=a.get(0);  
                alert(s);  
                //alert("rettttttttt" + a);  
                window.location="my_details.html?" + s;  
               //document.getElementById("location").value=a.get(0) + " ";  

                //alert(a.get(0) + " ");  
                //fetch my details from native  

                   }  
                else  
                  { 
                   // user clicked 'No'  
                  // display new form  
                 alert("no");  
                    }  
                });  

 }  
 </script>  

and in my_details.html :

 function submitForm(){  

     //var policyNumber=document.getElementById("number").value;
    //var a=camera.getDetails();
     var q=window.location.search;  
     if (q.substring(0, 1) == '?') {  
         q = query.substring(1);  
     }  
       alert("qqqqqqqqqq "+ q);  
 </script>   

How to pass data between scripts?

I resolved it in the following way:

 var c=new Array(a);    (eg: a={"1","2"})
 window.location="my_details.html?"+  c + "_";     

and in my_details.html :

var q=window.location.search;   
alert("qqqqqqqqqqqqq " + q);  
var arrayList = (q)? q.substring(1).split("_"):[];     
var list=new Array(arrayList);  
 alert("dataaaaaaaaaaaa " +  list  + "llll " ); 

and in "list" its dusplaying me "1%202";

How can i remove this %20 =space value ??

thanks
Sneha

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

衣神在巴黎 2024-12-28 15:36:36

你是说这个吗?

function show_confirm() {  
  //var r=confirm("Do you wish to use the existing Details?");
  apprise('Do you wish to use the existing details?', {'verify':true}, function(r) {  
    if(r) {
      // user clicked 'Yes'  
      var a=camera.getDetails();  
      window.location="my_details.html?" + a.join("_");  
    }  
    else { 
      alert("no");  
    }  
  });  
}  

function submitForm(){  
  var q=window.location.search;  
  var arrayList = (q)? q.substring(1).split("_"):[];  
}

You mean this?

function show_confirm() {  
  //var r=confirm("Do you wish to use the existing Details?");
  apprise('Do you wish to use the existing details?', {'verify':true}, function(r) {  
    if(r) {
      // user clicked 'Yes'  
      var a=camera.getDetails();  
      window.location="my_details.html?" + a.join("_");  
    }  
    else { 
      alert("no");  
    }  
  });  
}  

function submitForm(){  
  var q=window.location.search;  
  var arrayList = (q)? q.substring(1).split("_"):[];  
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文