2

How can I change the contents of my paragraph as well as the contents of my list once the link was clicked. reference: http://dummyproto.atspace.co.uk/

once i click woven badges on the navigation carousel i want to change the contents of the p as well as the imaged displayed. Is that possible via javascript? Is it a great alternative rather than creating a bunch of html pages for every page which has the same layout but different contents.

I'm looking forward to detailed solutions.Thanks

Teffi
  • 2,498
  • 4
  • 21
  • 40
  • Probably what you need: http://stackoverflow.com/questions/2554149/html-javascript-change-div-content – Tudor Dec 09 '11 at 15:52

3 Answers3

3

You need to modify your HTML a bit first so the content you want to swap out is contained in a single element that is easily selectable (for example wrap a div with a unique class name or id around just the stuff you want to swap out). Then do something like this:

document.getElementById('whateverIdYouGaveTheDiv').innerHTML = "blah blah blah";
Dagg Nabbit
  • 75,346
  • 19
  • 113
  • 141
  • thats fine with p element but how can i execute that if i would change this
  • I have to change the small image,largeimage and the img. – Teffi Dec 09 '11 at 16:06
  • I guess you would put it in a function and then call that function instead of doing nothing where you have `javascript:void(0);` ... although generally I think using the `javascript:` URI scheme is considered bad form... – Dagg Nabbit Dec 09 '11 at 16:10
  • ah.well i just got that from a jqzoom plugin. i just keep tweaking them. do you know how can i do the function for it? – Teffi Dec 09 '11 at 16:17