PDA

View Full Version : Worls in Mozilla but not in IE6


Paul X365
04-14-2003, 06:03 PM
Hello,

As the subject says this -


<SCRIPT LANGUAGE="JavaScript">
<!--
ValueHost = 'hs0256238';
ValueLoaded = false;
ValueID = 'pagebuster123';
ValueVersion = '1.1';
ValueBannerType = 'std';
ValueWidth = 468;
ValueHeight = 60;
//-->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!--
var phpadsbanner = '';
phpadsbanner += '<'+'SCRIPT LANGUAGE=\'javascript\' SRC=\'http://oz.valueclick.com/jsmaster\'><'+'/SCRIPT>\n';
phpadsbanner += '<'+'SCRIPT LANGUAGE=\'JavaScript\'>\n<'+'!--\nif (ValueLoaded) ValueShowAd();\n//-->\n<'+'/SCRIPT>';
document.write(phpadsbanner);
//-->
</SCRIPT>


Works in mozilla but does nothing in IE6. It does not produce any errors and the word done is present on the status bar, it just gives a blank page.

I have tried replacing the < and " with the respective \u00xx codes but still no luck.

If i move the second phpadsbanner line to a seperate script \script tag it work ok, however all this must be contained in one script tag.

If anyone can shed any light on this i would be greatefull.

Many thanks

ahosang
04-14-2003, 06:40 PM
You must break up the script hiding bits as well:
phpadsbanner += '<'+'SCRIPT LANGUAGE='JavaScript'>\n<'+'!--\nif (ValueLoaded) ValueShowAd();\n//--'+'>\n<'+'/SCRIPT>';

Paul X365
04-14-2003, 07:57 PM
I just tried that with no luck, but thanks anyway.

Here is a link to a test page.
Test Page (http://www.xbox365.com/test.html)


Thanks again

Graeme Hackston
04-14-2003, 10:57 PM
Try it like this

I added .js to the file path


var phpadsbanner = '';
phpadsbanner += '<\script src="http://oz.valueclick.com/jsmaster.js" type="text/javas\cript"></s\cript>\n';
phpadsbanner += '<\script type="text/javas\cript">\nif (ValueLoaded) ValueShowAd();</s\cript>';

Graeme Hackston
04-14-2003, 11:10 PM
Just looking at this. Why are you document.writing this?

if (ValueLoaded) ValueShowAd()

Paul X365
04-15-2003, 04:19 AM
I have changed this post as most of it was irelivant.

OK new simplified question.

<SCRIPT LANGUAGE="JavaScript">
<!--
ValueLoaded = false;
var phpadsbanner = '';
phpadsbanner += '<\script src="http://www.xbox365.com/jsmaster.js" type="text/javas\cript"></s\cript>\n';
document.write(phpadsbanner);
//-->
</SCRIPT>

The above script loads the below script from the server, in Mozilla both the alert hello and the document.write hello appear, In IE6 only the alert hello shows nothing else, no errors, just a blank page.

Why ???


ValueLoaded = true;

if (ValueLoaded) ValueShowAd()

function ValueShowAd() {

alert("Hello");
document.write("hello");

}

Edit

Its doing something wierd, if you refresh the page it still dosnt show the "hello" however if you highlight the address and press enter it does show it... This is messing with my head.

Here is a test page (http://www.xbox365.com/test.html)

Thanks for any help

Graeme Hackston
04-15-2003, 10:58 PM
I don't know what's going on. I saved the page and the js file and it works in IE6 win98. I used a relative path for the js file, try that and see what happens

Graeme Hackston
04-15-2003, 11:11 PM
Just a thought. I know scripting freezes until an alert is click but I don't know if page loading stops. Could the page be loaded in the background before the document write? Try putting the alert after the document write.

Paul X365
04-16-2003, 02:23 AM
Thanks Graeme,

You were spot on there with the alert box.

It seems my debugging alert box's were interfering with script execution and leading me down the proverbial......

So to sum this all up, I fixed the problem by moving the function call from the first calling page to inside the script that is loaded.
I will have to host valueclicks script which I am sure they will not be too happy about but unless they change it I should be ok....

Thanks for all your help.