...

View Full Version : Weird issue..



KoRe
12-15-2009, 12:59 PM
Now this is really stumping me otherwise i wouldnt be here.

I have a Javascript that i have that runs in a php site, i have a section where i can save the code to a part in my admin section for loading special images in diffrent locations. So i used java script for rotation on those images.

The funny thing is it loads up in a few pages where it calls the php code.
but in other pages it doesnt load anything at all. The call function works. in all pages but where the javascript doesnt work the static image i can place works. But i need it to use the javascript code so i can rotate them aswell.

For example:


<div id="footads">
<div id="fad">
<? echo $foot1 ?>
</div>
<div id="fad2">
<? echo $foot2 ?>
</div>
<div id="fad1"></div>
</div>

the $foot1 and 2 are footer call function which pulls the java script. I have no problem running multi versions of this script as i change the vars etc in java to make them run.

How ever like i said its not loading in some pages. but others it will?

here is some linked examples.

Working - Default advert images set on 10 sec delays (http://www.mmobattles.com/index.php)
Working diff page - Default advert images set on 10 sec delays (http://www.mmobattles.com/console.php)

not Working - Default advert images set on 10 sec delays (http://www.mmobattles.com/staff.php)

Its like its not calling the code from the function, But it is because if you view source.


<div id="footads">
<div id="fad">
<script language="JavaScript" src="/adverts/addbanner1.js" type="text/javascript"></script>
<div class='addbanner1'><div id='addbanner1'></div></div><div style="clear:both;"></div>
</div>
<div id="fad2">
<script type= "text/javascript" src="/adverts/addbanner2.js" type="text/javascript"></script>

<div class='addbanner3'><div id='addbanner3'></div></div><div style="clear:both;"></div>
</div>
<div id="fad1"></div>
</div>

gusblake
12-15-2009, 02:05 PM
addbanner1.js, line 25: LinkTarget is undefined. Should be LinkTarget1, maybe.

The pages that work call addbanner.js, those that don't work only call the numbered pages.

My advice would be:

Get Firebug.

Learn object oriented programming - use multiple instances of the same object instead of creating a new file and renaming all your variables.

KoRe
12-15-2009, 04:24 PM
addbanner1.js, line 25: LinkTarget is undefined. Should be LinkTarget1, maybe.

The pages that work call addbanner.js, those that don't work only call the numbered pages.

My advice would be:

Get Firebug.

Learn object oriented programming - use multiple instances of the same object instead of creating a new file and renaming all your variables.

Thanks for the tip how ever its not what im looking for as an answer. linktarget is declared under linktarget1 your right but that only refers to what happens when you click that image. ie: self _new etc.

The problem im trying to resolve is the issue of the images not loading at all on the other pages, but yet they work on some other pages as shown from the links above. 2 working pages 1 non working page using same code. being pulled from a call function in php.

question is why does it work in those pages and not in the other?

reason for having mutli's is each one is loaded under a diffrent call function each image loaded needs to have set dimentions in that call function so i cannot use same one.

gusblake
12-15-2009, 05:41 PM
I still don't think it's anything to do with PHP - the images don't appear because there is a javascript error when it tries to insert LinkTarget, which stops the script from completing.

I don't think there is any situation that calls for the amount of similarly named global variables you are using - if the dimensions are different, why not pass them as arguments to an object constructor? It would make everything a lot simpler.

KoRe
12-15-2009, 11:26 PM
Lol sorry dude i was up late last night like 4am. trying to do this i even mis read your last post about the linktarget being off as described. thanks for pointing that out. sorry for being a dumbass lol.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum