Div and span: Difference between revisions

Content deleted Content added
rm self-redirect
Line 25:
 
===Access from code===
Once the HTML or XHTML markup is delivered to a page-visitor's client browser, there is still the chance that client-side code will need to navigate access the internal structure (or [[Document Object Model]]) of the web page.
 
The most common reason for this is that the page is delivered with client-side [[JavaScript]] that will produce on-going dynamic behaviour after the page is rendered. For example, if rolling the mouse over a 'Buy now' link is meant to make the price, elsewhere on the page, become emphasised, JavaScript code can do this, but it needs to identify the price element, wherever it is in the markup in order to affect it. The following markup would suffice: <code>&lt;div id="price"&gt;$45.99&lt;/div&gt;</code>. Another example is the [[Ajax (programming)|Ajax]] programming technique, where, for example, clicking a hypertext link may cause JavaScript code to retrieve the text for a new price quotation to display in place of the current one within the page, without re-loading the whole page. When the new text arrives back from the server, the JavaScript must identify the exact region on the page to replace with the new information.