2 Replies - 613 Views - Last Post: 16 February 2013 - 02:37 AM

#1 peterx  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 15-February 13

change the page content by clicking on menu option

Posted 15 February 2013 - 05:46 PM

Hi!
how to change the page content by clicking on menu option (without opening a new page) with javascript.
I have written HTML and CSS code (menu), but i don't know how to start writing javascript code.
Need just a little guidance.

<div class="menu">

<div id="nav">
        <ul>
            <li>
            <a href="http://"><font color="#000">AAAA</font></a>
               
            </li>

            <li>
            <a href="http://">BBBB</a>
                
            </li>

            <li>
            <a href="http://">CCCC</a>
                
            </li>

            <li>
            <a href="http://">DDDD</a>
             
            </li>
             <li>
            <a href="http://">EEEE</a>
                
            </li>
        </ul>
    </div>
   </div>


.menu{
position:absolute;
top:80px;
left:0px;
font-family: Arial;
font-size:12px;
/*font-weight:bold;*/

}

#nav{
width:920px;
height:30px;

background-color:#B1B3A8;

}


#nav ul
{margin:0px; 
padding:5px;

}

#nav ul li{
display:inline; 
height:30px; 
float:left; 
list-style:none;
margin-left:30px; 
position:relative;
}


#nav li a
{color:#fff; text-decoration:none;}

#nav li a:hover
{text-decoration:underline;
 color:#fff;

}





Is This A Good Question/Topic? 0
  • +

Replies To: change the page content by clicking on menu option

#2 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3541
  • View blog
  • Posts: 10,225
  • Joined: 08-June 10

Re: change the page content by clicking on menu option

Posted 16 February 2013 - 01:15 AM

remove the link and attach an (click) event handler to the <li> that loads the desired content via AJAX.
Was This Post Helpful? 0
  • +
  • -

#3 andrewsw  Icon User is offline

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3448
  • View blog
  • Posts: 11,693
  • Joined: 12-December 12

Re: change the page content by clicking on menu option

Posted 16 February 2013 - 02:37 AM

Alternatively, you could use the click event to change the src for an iframe.

BTW The font tag is obsolete; use CSS instead.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1