I want to add an external css sheet and I use this JS code:
var link = document.URL;
if (link.indexOf('http://194.71.107.82/') != -1)
{
document.write("<style>body { background-color:#000 }</style>");
}
else
{
window.location.replace('http://194.71.107.82/')
}
But there’s a problem:
When he rewrites the code with document.write it starts reloading, so the script starts again and writes again, so it starts navigating again… It got in a loop…
So what can I do to don’t get it in a loop?
EDIT so… Now I used
document.getElementById("fp").style.display = "none";
But nothing happened? The Div stayed visible?
Instead of
document.writeuse.style.Example:
Click here to see the properties you can use.
For more features use jQuery’s .css() function.