Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

My div does not exists after loading my pixel

Tags:

javascript

I have a pixel and when I load it, it says:

a call to document.write() from an asynchronously-loaded external script was ignored

and then displays:

document.getElementById('gospixel') is null

Here's my pixel code:

<script name="gospix" src="http://www.example.com/p/gospixel.js">

and in that file:

gos_f=42;
gos_a1='a2';
gos_u=window.location.href;
gos_k='6gZYlfy7Y7Q';
gos_rt='3_s';
document.write(unescape("%3Cscript src='http://example.com/p/gosuna.js' type='text/javascript'%3E%3C/script%3E"));

Thanks for your help!

like image 901
Tech4Wilco Avatar asked Sep 29 '11 15:09

Tech4Wilco


People also ask

Why is my div background image not showing?

you have to change your path background-image: url('/ximages/websiteheader1. png') ; TO background-image: url('ximages/websiteheader1. png') ; actually, remove the first / from the path of the image.

Is div display blocked?

The <div> element is a block-level element.

How do I keep my div fixed?

A pinned-down menu The interesting rule here is the ' position: fixed ', that makes the DIV stay fixed on the screen. The ' top: 50% ' and ' right: 0 ' determine where the DIV is displayed, in this case: 50% down from the top of the window, and a constant 0px from the right.

How do I force an image to stay inside a div?

You can force the content of the HTML <div> element stay on the same line by using a little CSS. Use the overflow property, as well as the white-space property set to “nowrap”.


1 Answers

Don't use document.write. view this thread: Why is document.write considered a "bad practice"?

Instead, use dynamic object like document.createElement and appendChild.

http://www.dustindiaz.com/add-and-remove-html-elements-dynamically-with-javascript/

This will slove your error.

like image 167
Pat R Ellery Avatar answered Sep 20 '22 01:09

Pat R Ellery