Fill Form Hidden Field with Querystring Paramater

I have need to populate a hidden field on a Form with a value from incoming querystring with javascript.
I used the script I found from this thread to get the job done.

function getquerystring() {
    var url = location.href;
    if (url.split('?')[1] != undefined) {
        var qs = url.split('?')[1];
        String.prototype.splitquerystring = function () {
            return this.split(/[=&]/);
        document.getElementById('promocode').value = qs.splitquerystring()[1];

//        for (var c = 1; c < qs.splitquerystring().length; c += 2) {

//            document.getElementById('inp' + c).value = qs.splitquerystring()[c]; 
//        } 

window.addEventListener ? window.addEventListener('load', getquerystring, false) : window.attachEvent('onload', getquerystring); 

Add line break in Javascript from HTML page

Here is the syntax for how to get the line break \n from an HTML element to show in an Alert box:

<script type="text/javascript">

function fnGetLineBreak() {


"teksts").innerHTML.toString().replace(‘\\n’, "\n"));





input type="button" value="Show First DIV Content" onclick="fnGetLineBreak()" >


id="teksts">line 8\nline 9</a>


<a id="teksts">line 8\nline 9</a>