Jump to content

How to get it into one script tag?


dflow
Go to solution Solved by 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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.