Jump to content

How to get it into one script tag?


dflow

Recommended Posts

This code works:

How can I execute this in one script tag? 

<script>

var urlParams;
(window.onpopstate = function () {
    var match,
        pl     = /\+/g,  // Regex for replacing addition symbol with a space
        search = /([^&=]+)=?([^&]*)/g,
        decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); },
        query  = window.location.search.substring(1);

    urlParams = {};
    while (match = search.exec(query))
       urlParams[decode(match[1])] = decode(match[2]);
})();

	var a = urlParams["a"];
	var b = urlParams["b"];
	
	// var url = "http://example.com/tracker/"+ a +'/' + b;

	

	var iDiv = document.createElement('img');
	iDiv.id = '5050';
	iDiv.src = +url;
	iDiv.width = '14';
	iDiv.height = '14';
	document.getElementsByTagName('body')[0].appendChild(iDiv);

	iDiv.appendChild(innerDiv);
</script>
<script>

   	 document.getElementById("5050").src ="http://example.com/tracker/"+ a +'/' + b;
</script>
Link to comment
https://forums.phpfreaks.com/topic/294301-how-to-get-it-into-one-script-tag/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.