No announcement yet.

Linking to Javascript in template's header

  • Filter
  • Time
  • Show
Clear All
new posts

  • Linking to Javascript in template's header

    I'm trying to link to a single javascript file from inside the header template using the following code. I've tested this code in a non-vB HTML page and it works fine, but when placed into the header template through the admin CP, this same code doesn't seem to work:

    <!--[if lte IE 6]>
    <script type="text/javascript" src="supersleight.js"></script>
    any reason why the script may not be working?

    This is where the script is from:

  • #2
    You'd better place scripts in headinclude, so they are inside the <head>...</head> tag.


    • #3
      Thanks for your reply, I've just tried adding the code into the headinclude template, but the script still does not work, ie. the background of the .png image still does not show transparency in IE6. The strange thing is that the script works fine in a normal HTML webpage when I try it (by changing the filepaths accordingly), but it doesn't seem to work in vBulletin. I see some other codes in the headinclude template for other javascript files, but including the new code close to these codes does not fix the problem either.


      • #4
        Have you updated the path to x.gif to work properly?


        • #5
          yes, I've just double-checked that the filepath to x.gif is correct. I've also deleted my temporary internet files before refreshing the page as this might have prevented the transparency from showing up, but unfortunately the problem remains.


          • #6
            I think I may have found the solution to my problem, I just need to test it out and will post here in a few mins with the outcome...


            • #7
              yep I'm pleased to say that the problem's solved now, I had a url rewrite / redirect on the .png image on my vB page, so the forum thought it was linking to a .gif icon whereas I was redirecting it to a .png file. I guess the Javascript can't recognise such redirects so treated the image as a .gif instead, hence didn't apply the transparency effect on the .png.

              Thanks again Michelle for being helpful


              Related Topics