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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Seach for pre-defined html string and add code before and after this html string.

    Hello...


    I'm looking for a javascript "hack" there can find a pre-defined html-string, lets say:

    Code:
    <img src='/images/adserving/images/bestil.gif' border='0' alt=''>
    and add:

    Code:
    <script>utmx_section("Indsæt afsnitsnavnet her")</script>
    in just before the pre-defined html-string. And the following code just after:

    Code:
    </noscript>
    So it looks like this:

    Code:
    <script>utmx_section("Indsæt afsnitsnavnet her")</script><img src='/images/adserving/images/bestil.gif' border='0' alt=''></noscript>

    The reason behind this is that i'm using a editor that do not allows me to directly changing the code of my website. Only possible to add code in the header and in the buttom of the page (in the body). Its for for making a multivariate split-test using Google Website Optimizer.

    Thanks in advance!

    - Anders

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    1. You need also the start tag<noscript> if you want the </noscript> end tag to have a meaning. Do you know what <noscript></noscript> does?
    2. You must find a way to refer that image element. If you have no id, no class, no nothing, you must find something which is characteristic only to that tag. Could be the position/order in the DOM tree, but for that you should told us the position, or to count it by your self.

    Do you know HTML? Do you know JavaScript? Do you know DOM?
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Tags for this Thread

    Posting Permissions

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