Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need Advise On Adding a <TAG> element on DocLoad

Status
Not open for further replies.

dalvin200

Programmer
Oct 10, 2000
20
GB
Hi,

I'm having severe problems adding a <tag> (the TAG is my own tag) but at runtime. I only want the tag to be inserted depending on some condition.

Basically, what i want to do is, insert the <tag> part into a certain place in the BODY..
in my debugging i found that the innerHTML bit didnt like me using the '<' or '>' which i had to replace with the HTML code &amp;lt; and &amp;gt; respectively - but this still didn't work !!

the code i have in my jscript is :

-----------------------
var a = &quot;<experian_process_point type=Nav value=CPP_Nav_BurSearch>&quot;

pos = document.body.innerHTML.indexOf(&quot;experian_process_point&quot;);

body = document.body.innerHTML;

newbody = body.slice(0,pos-1) + a + body.slice(pos-1)

document.body.innerHTML = newbody;
---------------------------------

when i query newbody, the string i inserted, isnt there !! and i dont understand why its not being inserted.

Any help please ?

I need help ASAP - as its urgent !

Thanks
 
Hi dalvin200!

Try to cut var a into 2 pieces:
var a1 = &quot;<experian_process_point &quot;;
var a2 = &quot;type=Nav value=CPP_Nav_BurSearch>&quot;

Andrew | starway@mail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top