JavaScript URL parse to load multiple versions

<script type=”text/javascript” src=”js/jquery-1.3.2.min.js”></script>

<script>
$(document).ready(function() {

<!– Version requested START –>
if (location.search != “”)
{
x = location.search.substr(1).split(“;”)
for (var i=0; i<x.length; i++)
{
y = x[i].split(“=”);
//alert(y[0] + ” ” + y[1])

// Version 2 (/?version=2)
if( y[1] == 2 ){
// do things
}

// Version 3 (/?version=3)
if( y[1] == 3 ){
// do things
}
}
}
<!– Version requested END –>

Comments are closed.