Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

JavaScript needed

6:22 pm on Sep 15, 2001 (gmt 0)

Junior Member

10+ Year Member

joined:July 24, 2001
votes: 0

Can anyone point me to a Javascript example that allows me to change the contents of a <p> element with the press of a button?
5:32 am on Sept 16, 2001 (gmt 0)

Junior Member

10+ Year Member

joined:July 20, 2001
votes: 0

Hi JakeFrederick,

This is the most direct method, and works with IE5+ and NS6, but not with NN4.x nor Opera.

<script type='text/javascript'>
function changeP() {
document.getElementById('p1').innerHTML = "This is the <b>new</b> content for <i>my paragraph</i>.";

<form onsubmit='return false'>
<input type='button' value='Click Me' onclick='changeP()'>

<p id='p1'>This is my paragraph</p>



Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members