Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: Weird issue..

  1. #1
    New Coder
    Join Date
    Feb 2009
    Posts
    22
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Weird issue..

    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:

    Code:
    			   <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
    Working diff page - Default advert images set on 10 sec delays

    not Working - Default advert images set on 10 sec delays

    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>
    Last edited by KoRe; 12-15-2009 at 12:03 PM.

  • #2
    Regular Coder
    Join Date
    Jan 2006
    Posts
    568
    Thanks
    6
    Thanked 84 Times in 84 Posts
    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.
    Last edited by gusblake; 12-15-2009 at 01:16 PM.

  • Users who have thanked gusblake for this post:

    KoRe (12-15-2009)

  • #3
    New Coder
    Join Date
    Feb 2009
    Posts
    22
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by gusblake View Post
    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.
    Last edited by KoRe; 12-15-2009 at 03:27 PM.

  • #4
    Regular Coder
    Join Date
    Jan 2006
    Posts
    568
    Thanks
    6
    Thanked 84 Times in 84 Posts
    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.

  • #5
    New Coder
    Join Date
    Feb 2009
    Posts
    22
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •