Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Link to alter another CSS element on the same page?

I'm trying to learn CSS/HTML etc and need some more advice/help!!

Ok, so say you've got two 300 x 300 elements/divs on the screen... The first element/div has a couple of links in it - something like:

<a href="new page 1">new page 1</a>

and

<a href="new page 2">new page 2</a>

... Is there any way to use this system to just alter the information (txt/background image etc) in the other 300 x 300 element/div on the screen rather than load up a new page altogether??

Does that make sense?

Has it got something to do with frames or something? Or is that something totally different!?

4 Answers

Relevance
  • Anonymous
    1 decade ago
    Favorite Answer

    What you're looking for is actually DHTML (Dynamic HTML). Javascript can alter the content of a part of the document. (AJAX uses the concept, but you don't need AJAX if the document itself is altering the document - AJAX sends data to a server page, php or ASP, gets data back and alters the page with that data.) Try http://w3schools.com/htmldom/default.asp to learn the document object model and http://w3schools.com/dhtml/default.asp for a DHTML tutorial. You'll need to learn Javascript - that's what does the work of changing parts of the document (the contents of a div in your case).

  • 1 decade ago

    What you are talking about is usually solved with a relatively new and complicated (for a novice) concept, AJAX (asynchronous JavaScript and XML). It's where you make XML work with Javascript to load only PART of a page. I'm not sure that you want to bother with this. You say that you're only now beginning to learn the ropes of HTML and CSS. I'd say that you should have a firm footing in these two concepts before you move onto the tougher concept of AJAX, where you can control individual div tags.

    A frame is a good idea, since you're only loading what's inside the frame, but that still requires loading of another web page, only it will be inside an existing web page.

    I hope this helps and doesn't put you off web design, because it's a great skill to posses.

    Pat.

  • 1 decade ago

    You could use the Javascript so that when the link is clicked the div related to it either opens or closes. Link here, http://www.harrymaugans.com/2007/03/05/how-to-crea...

  • Anonymous
    1 decade ago

    This look like a good one.

    http://drupal.org/project/alter_css

Still have questions? Get your answers by asking now.