SAYFANIN QUERY STRINGINI ALMA-JAVASCRİPT


function getQueryStrings() {
    var message = document.getElementById("myOutputArea");
    var dataParameterString, querystring;
    // get data from querystring
    if (window.location.search != "") {
        querystring = window.location.search.substr(1).split("&");
        for (var i in querystring) {
            querystring[i] = querystring[i].replace(/\+/g, " ").split("=");
        }
        //look for the parameter named 'data'
        for (var i in querystring) {
            if (querystring[i][0].toLowerCase() == "data") {
                dataParameterString = querystring[i][1];
                break;
            }
        }

        message.innerText += dataParameterString;

    } else {
        message.innerText = "No details were specified in the querystring.";
        alert("ERROR: " + message.innerText);
    }
}    

Hiç yorum yok:

Yorum Gönder