CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2009
    Posts
    2

    Javascript Src Help

    Hi I have a problem which I cant seem to get my head around.

    Let me just quickly explain the scenario.

    I have a website which contains a left navigation section where users click to access different parts of the site.

    This left navigation section is done by using:

    <script type="text/javascript" src="ItemName.js"></script>

    on all the pages that I want the navigation bar to appear.

    In the ItemName.js File I am using:

    document.write("Insert Html code here");

    This all works fine for me when I have a html code to insert in there as i just replace the "" in the html codes with '' and then it works.

    However, Now i want to put javascript contents into the Itemname.js File as i want to add a google adsense onto it. However google adsense code is given in javascript and not html.

    This is where I am confused and dont know what to do.

    Is there a way that i can use the same method to include the google javascript in my ItemName.js file?

    I want to do this because then i wont need to go through 100+ webpages and edit and update them all with the google adsense code.

    The google adsense code is:

    <script type="text/javascript"><!--
    google_ad_client = "pub-0044630742873078";
    /* Hitman Reborn Kun */
    google_ad_slot = "7892258453";
    google_ad_width = 468;
    google_ad_height = 60;
    //-->
    </script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>

    Hope someone can help. Thank you for your help in advance.

  2. #2
    Join Date
    Jul 2005
    Location
    Currently in Mexico City
    Posts
    568

    Re: Javascript Src Help

    Code:
    document.write("<script type=\"text/javascript\">");
    Is that what you needed? Or is there some other problem?
    Wanna install linux on a vacuum cleaner. Could anyone tell me which distro sucks better?

    I had a nightmare last night. I was dreaming that I’m 64-bit and my blanket is 32-bit and I couldn’t cover myself with it, so I’ve spent the whole night freezing. And in the morning I find that my blanket just had fallen off the bed. =S (from: bash.org.ru)

    //always looking for job opportunities in AU/NZ/US/CA/Europe :P
    willCodeForFood(Arrays.asList("Java","PHP","C++","bash","Assembler","XML","XHTML","CSS","JS","PL/SQL"));

    USE [code] TAGS! Read this FAQ if you are new here. If this post was helpful, please rate it!

  3. #3
    Join Date
    Sep 2009
    Posts
    2

    Re: Javascript Src Help

    Question resolved. Can lock and delete this thread now.

    Thanks very much for everyons help.

  4. #4
    Join Date
    May 2002
    Posts
    10,943

    Re: Javascript Src Help

    We don't delete threads when a question is answered. That would be ridiculous since we exist to help others. Why delete threads that might help.

    However, there is the "Mark Thread Resolved" option under that "Thread Tools" menu. This helps to let others know that your original question has been answered.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured