Forum Moderators: open

Message Too Old, No Replies

why does adsense display in wrong position?

         

acupofwater

7:01 pm on Sep 2, 2007 (gmt 0)

10+ Year Member



I use js to call my adsense ad, the calling code is like that :
<script language='javascript' src='/js/ggad.js'></script>

and the content in this js file ggad.js is:

---------------------------------------------------------------------------?-------------------------
document.writeln("<div><script type=\"text/javascript\"><!--");
document.writeln("google_ad_client = \"pub-000000000000\";");
document.writeln("google_alternate_color = \"FFFFFF\";");
document.writeln("google_ad_width = 336;");
document.writeln("google_ad_height = 280;");
document.writeln("google_ad_format = \"336x280_as\";");
document.writeln("google_ad_type = \"text_image\";");
document.writeln("//2007-09-02: Body336");
document.writeln("google_ad_channel = \"1646757067\";");
document.writeln("google_color_border = \"FFFFFF\";");
document.writeln("google_color_bg = \"FFFFFF\";");
document.writeln("google_color_link = [\"2D8930\",\"3D81EE\",
\"C94093\",\"1F3A87\"];");
document.writeln("google_color_text = \"000000\";");
document.writeln("google_color_url = \"666666\";");
document.writeln("//-->");
document.writeln("</script\>");
document.writeln("<script type=\"text/javascript\"");
document.writeln(" src=\"http://pagead2.googlesyndication.com/pagead/
show_ads.js\">");
document.writeln("</script\></div>");

document.writeln("<div><a href=\"http://sample.org/\" target=\"_blank
\"><U>This is my own text link!</U></a></div>");

---------------------------------------------------------------------------?-------------------------

the display i expected should be like this:

------------------
google adsense
This is my own text link!
------------------
i.e. google adsense display on the top of my own text links.
and the html shows the above result before I convert it to js.

but the actual display with this js file is like this:
------------------
This is my own text link!
google adsense
------------------
the google adsense display itself underneath my own links.

I also tried to use table to fix the postion other than div ,I put adsense and my own links into diffrent td, but also failed.

Note: this wrong display only shows in IE, all right in Firefox and Opera.

I really can't understand why the location changes with the same code when they are converted to js. (the html shows the right postions)

really appreciate your kind help!

thanks a million!

acupofwater

4:32 am on Sep 3, 2007 (gmt 0)

10+ Year Member



did anyone get the same problem?

penders

2:33 pm on Sep 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Where are you calling your ggad.js file from?

Just a couple of points... you don't need to writeln all the google variable assignments, these can be left in your ggad.js file as straight forward JS and they will be picked up.

If you used single quotes to delimit your JS strings, then you wouldn't need to escape all the double quotes used for the HTML attributes.

Do you need to include the backslash (escape) in your closing script tags?

document.writeln("</script\></div>");

As to why your content is the wrong way round in IE I'm not sure. Do you have any CSS styling? Does the google code do something particular in IE?

carguy84

3:18 pm on Sep 6, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Fix this:
</script\>

to read:
</script>

and it will solve your problem.

Basically the browser is reading it as </script</div> so the first <div> closes with the LAST </div>.

Chip-