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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

innerHTML 1

Status
Not open for further replies.

askey

Programmer
Jun 9, 2002
5
DE
Hello everybody!

I have a problem with the following function:

function test()
{
document.all.example_1.innerHTML = &quot;<p onClick=&quot;test2()&quot;>It's just a test</p>&quot;
}

the second function test2() works fine on it's own, but if I try to integrate test2() in test() on the written way, I get an error. I think that is because of the &quot; I need for test2(). But I don't know how to circumvent this.

Thanks in adavance for any kind of help.

askey

PS: I'm sorry for my bad english, but I'm german.
 
Hi,

Instead of..
Code:
&quot;<p onClick=&quot;test2()&quot;>It's just a test</p>&quot;

Can you please try to use a button
Code:
&quot;<button value=&quot;It's just a test&quot; onClick=&quot;test2()&quot;>

I think you have a problem to include onClick in the <p> tag?

If you really need to use a text link, we can do it another way.

Hope it helps,

Graham
 
I tried the button-version, but it doesn't work.

>>> I think you have a problem to include onClick in the <p> tag?

not realy, i have onClick in other <p> tags and it works fine.
 

My error, sorry, can you try this?

&quot;<input type=button value=&quot;It's just a test&quot; onClick=&quot;test2()&quot;>
 
Maybe because of nested quotes?


try

document.all.example_1.innerHTML = &quot;<p onClick='test2()'>It's just a test</p>&quot;

where 'test2()' instead of &quot;test2()&quot;
 
many thanks. the last version works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top