-2

I am new on web coding. I use weebly drag and drop but also HTML to add extra things. What I did is has created a variable that includes customers' selections about a product. I would like to add this variable.value to the specific products' short description.

Any help will be appreciated.

Here is my code for to get this variable from another page so final step is to get this variable from product page, short-description section.

Thanks

Tim

    <html> <body> <script>

    var queryString = decodeURIComponent(window.location.search); 
    queryString = queryString.substring(1); 
    var queries = queryString.split("&"); 
    for (var i = 0; i < queries.length; i++) {   
         document.write(queries[i] + "<br>"); 
    }

    </script>  </body> </html>
AbraCadaver
  • 78,200
  • 7
  • 66
  • 87
Tim
  • 1

2 Answers2

1

If you already have the variable set, just use this in your script document.getElementById("TheIdOfTheDiv").innerHTML = TheVariable;

0

The below js fiddle link might help you to easily decode the url

https://jsfiddle.net/bachiavinash/rc3LsjLo/

js code:

function dispnameval(){
  var $input = document.f1.t1.value;
  var $output = "";
  var $inurl = $input.split("?");
  var $ary = $inurl[1].split("&");
  var $arylen = $ary.length;
  var $start = $input.indexOf("?");
  var $end = $input.indexOf("=");
  //var $output = $input.substring($start,$end);
  //$output = $ary[0];
  for($i=0; $i<$arylen; $i++){
    //alert($ary[$i]);
    $output+=$ary[$i]+"<br/>";
  }
  document.getElementById("output").innerHTML=$output;
}
function clearnameval(){
  document.f1.t1.value = "";
  document.getElementById("output").innerHTML="";
}
Shrugo
  • 137
  • 2
  • 10