Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-08-2011, 10:50 PM   PM User | #1
holm
New to the CF scene

 
Join Date: Jul 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
holm is an unknown quantity at this point
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
holm is offline   Reply With Quote
Old 07-11-2011, 10:17 AM   PM User | #2
Kor
Red Devil Mod


 
Kor's Avatar
 
Join Date: Apr 2003
Location: Bucharest, ROMANIA
Posts: 8,478
Thanks: 58
Thanked 379 Times in 375 Posts
Kor has a spectacular aura aboutKor has a spectacular aura about
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
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Kor is offline   Reply With Quote
Reply

Bookmarks

Tags
find, html, insert, javascript

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:16 AM.


Advertisement
Log in to turn off these ads.