most_user="Pimp.lv"; // 1) Build the most_string as before: document.cookie = "mostlvtop=1; path=/"; var most_string = "1=1"; most_string += "&refer=" + escape(document.referrer); most_string += "&page=" + escape(window.location.href); most_string += "&c=" + (document.cookie ? "yes" : "now"); most_string += "&java=" + (navigator.javaEnabled() ? "yes" : "now"); if (typeof screen !== "undefined") { most_string += "&screen=" + screen.width + "x" + screen.height + "x" + (screen.colorDepth ? screen.colorDepth : screen.pixelDepth); } most_string += "&rand=" + Math.random(); if (typeof most_user === "undefined") { most_user = "not_set"; } if (typeof most_domain === "undefined") { most_domain = "most.lv"; } // 2) Create the element var anchor = document.createElement("a"); anchor.href = "//" + most_domain + "/?u=" + most_user; anchor.target = "_blank"; // 3) Style the element anchor.style.position = "absolute"; anchor.style.left = "-10px"; anchor.style.top = "-10px"; anchor.style.width = "1px"; anchor.style.height = "1px"; anchor.style.overflow = "hidden"; anchor.style.textIndent = "1px"; // 4) Create the element var span = document.createElement("span"); span.style.display = "block"; span.style.width = "88px"; span.style.height = "31px"; // Build the full background URL: var backgroundUrl = "url(//" + most_domain + "/button.php?u=" + most_user + "&" + most_string + "&) no-repeat 0 0"; span.style.background = backgroundUrl; // 5) Append the to the , then append the to the DOM anchor.appendChild(span); // Typically append to the document body (or any other container you prefer) document.body.appendChild(anchor);