css - How can I get my hyperlink in HTML result in same page or window with or without using iframe tag or JavaScript? -


here 2 html files , 1 css file. question how open link monday.html on same page or window in section. i.e. when 1 click on mondy navigation button 1 result in content lorem ipsum shown.

/this index.html file

<html> <head> <title>navigation</title> <link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" /> </head> <body> <div id="wrap">         <h1>welcome page</h1>          <div id="content">             <h2>lorem ipsum</h2>             <p>lorem ipsum dolor sit amet, consectetuer adipiscing elit. duis felis. sed ac mauris eget              eros vestibulum luctus. phasellus ultrices consequat arcu. aliquam rhoncus, elit nec faucibus             scelerisque, nisi ligula imperdiet dui, in lacinia nulla odio sit amet lorem. praesent tristique,              orci ac posuere rhoncus, massa urna semper purus, et tempus justo massa massa. cras nec turpis             non massa lacinia facilisis. phasellus gravida nisl eget metus. fusce gravida, dui ac accumsan             sagittis, nisl quam interdum tortor, sed gravida risus lectus eget dui. aliquam vitae justo ac              risus gravida convallis. nulla quis diam mi aliquam tempor. duis dignissim erat vitae nisl.              fusce vel lorem. duis neque dolor, tempor nec, cursus id, convallis in, enim. morbi egestas              lobortis neque.</p>         </div>         <div id="sidebar">             <h2>weekdays</h2>             <ul>                 <li><a  href="monday.html">monday</a></li>                 <li>tuesday</li>                 <li>wednesday</li>                 <li>thursday</li>                 <li>friday</li>                 <li>saturday</li>                 <li>sunday</li>             </ul>         </div>         <div id="footer">             <p>copyright &copy; mypage</p>         </div>     </div> </body> </html>    css code follows:- /* mypage css file */  body {     margin: 0;     padding: 0;     background: #cfcdb4;     border-top: 10px solid #bcba9e;     font-family: helvetica, sans-serif;     color: #fff; }  p {     margin: 0 0 10px 0;     padding: 0;     line-height: 1.2em; }  h2 {     margin: 0;     color: #6d8ead; }  ul {     margin: 0;     padding: 0;     list-style-type: none; }  #wrap {     margin: 0 auto;     width: 800px;     background: #362416;     border-left: 5px solid #281a0f;     border-right: 5px solid #281a0f; }  #wrap h1 {     margin: 0;     padding: 10px;     text-align: center;     background: #553f2d;     border-bottom: 1px solid #362416;     color: #fff;     font-weight: normal;     font-family: georgia, serif; }   #content {     margin: 20px 0 0 0;     float: left;     width: 500px;     padding: 0 15px 0 15px; }  #content h2 {     margin: 0 0 10px 0;     font-size: xx-large; }  #sidebar {     float: right;     width: 260px;     margin: 20px 0 0 0; }  #sidebar ul {     margin: 0 0 0 10px; }  #sidebar ul li {     margin: 0 0 10px 0; }  #sidebar h2 {     background: #553f2d;     margin: 0 0 10px 0;     padding: 5px; }  #footer {     padding: 10px;     clear: both;     font-size: small; }  #footer p {     margin: 0;     padding: 10px;     background: #281a0f;     text-align: center; }    hyperlink monday.html follows:-   <html>     <head>     <title>monday</title>     </head>     <body>     monday page     </body>  <html> 

most basic way can think of using jquery.

$('#sidebar a').click(function(e){     e.preventdefault();     var location = $(this).attr('href');     $('#content').load(location); }); 

however should use proper ajax or $.get function if want more control


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -