Welcome to WebmasterWorld Guest from

Forum Moderators: not2easy

Message Too Old, No Replies

Changing contents of div or paragraph with a link in CSS



4:37 pm on Dec 13, 2001 (gmt 0)

10+ Year Member

How can I change the contents of a div or paragraph when the user presses a link using CSS? I am trying to create an image gallery where the user presses a thumbnail and the full image displays. I don't want to use pop-up windows and I don't want to refresh the screen or use frames. Can this be done easily?


5:55 pm on Dec 13, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Try this little sample, uses the innerHTML property. Won't work in NN4 but will in pretty much everything else.


function updateTestParagraph(string)
document.getElementById('test').innerHTML = string

var testString = "Look, DHTML wonder eh?"

<a href="javascript:updateTestParagraph(testString);" >click here</a>
<p id="test"></p>



6:29 pm on Dec 13, 2001 (gmt 0)

WebmasterWorld Senior Member rcjordan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

DHTML can add an SSI-type injection into a div. Here's the best one I've found to date, it works on NS4, NS6, & IE4 up.



Featured Threads

Hot Threads This Week

Hot Threads This Month