Search Engine Optimization     Web Development     SEO     Website Designing     Increase Ranking    

How to get variable value in javascript

How to get variable value in javascript

if you want to get value from query string in javascript

use
<script type=”text/javascript” language=”javascript”>// <![CDATA[
var qrStr = window.location.search;
var spQrStr = qrStr.substring(1);
var arrQrStr = new Array();
var arr = spQrStr.split(‘&’);

for (var i=0;i<arr.length;i++){
var queryvalue = arr[i].split(‘=’);
queryvalue[1]=queryvalue[1].replace(/%20/g,” “);
document.write(“”+queryvalue[1]+””);

}
// ]]></script>

like if you want to pick
query string value http://www.vimalinfotech.com/thank-you?msg=message sent successfully

it will return msg value

About admin

I am Vimal Kumar CEO of vimalinfotech.com.i have a great knowledge of seo,programming and web designing.I have spend 5 years in this field.
now managing vimalinfotech.com.