Wednesday, September 14, 2011

How to open a page in the same page without changing the link ?!?

Here's The deal . I give you an example . There is a page that in the middle shows some texts and pictures and .... I want to when you click on the link the content of the page be changed but not the navigation and menu and the banners . And i want it to show a loading pic while changing the content of the pageHow to open a page in the same page without changing the link ?!?There are many ways to go about this... one way i usually use is as follows:



Put the content you want to display when the user clicks the link in a layer %26lt;div%26gt; and set it's style to: display:none;



so it will look like this:



%26lt;div id=%26quot;mainContent%26quot; style=%26quot;display:none;%26quot;%26gt;

Here is what the user will see when the link is clicked.

%26lt;/div%26gt;



place this layer anywhere on your HTML page where you'd like it to appear...



now create your link which when clicked it will execute a Javascript function, like this:



%26lt;a href=%26quot;#%26quot; onClick=%26quot;javascript:DisplayContent();%26quot;%26gt;C?here to view main content%26lt;/a%26gt;



before your %26lt;/body%26gt; tag, add the following Javascript code:



%26lt;script type=%26quot;text/javascript%26quot;%26gt;

function DiplayContent() {



var main = document.getElementById('mainContent');



main.style.display = 'block';



}

%26lt;/script%26gt;



and that's it!How to open a page in the same page without changing the link ?!?Try using frames.How to open a page in the same page without changing the link ?!?i think you need to use css or something like that.



css= cascading style sheets.