Thursday, August 23, 2012

html js

//javascript get value from get method and dispaly in html file
<script type="text/javascript">
  function getParameterByName(name) {
                name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
                var regexS = "[\\?&]" + name + "=([^&#]*)";
                var regex = new RegExp(regexS);
                var results = regex.exec(window.location.search);
                if (results == null)
                    return "";
                else return decodeURIComponent(results[1].replace(/\+/g, " "));
            }
document.write("<font color='yellow'>Total amount will be charge from you bank: $" + a+"</font>");
document.write("<input type='text' name='IDEBIT_AMOUNT' value='" + amount + "' />");
 </script>

//js get value from get method and set value to html controlfunction window.onload() {
        var amount = getParameterByName("amount");
        var orderID = getParameterByName("glvTransID");
        var merchdata = getParameterByName("data");
      
        document.getElementById("IDEBIT_AMOUNT").value = amount;
        document.getElementById("IDEBIT_INVOICE").value = orderID;
        document.getElementById("IDEBIT_MERCHDATA").value = merchdata;
}

No comments:

Post a Comment