Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello Friends,

Here I have 5 pages, I have Anchor tag. when i click on first link it open in div named #content. i tried but i failed. so share your opinion.


Here is My Code.

HTML File
HTML
<!DOCTYPE html>
<html>
<head>
    <title></title>
	<meta charset="utf-8" />
    <link href="App_Themes/test.css" rel="stylesheet" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <script>
        $(function () {
            $('#sect1').click(function () {
               
            });
        });
    </script>



</head>
<body>
    <div class="header">
        <ul class="ul-menu">
            <li class="li-menu"><a href="SECTION1.html" id="sect1" onclick="check()">Section 1</a></li>
            <li class="li-menu"><a href="SECTION2.html" id="sect2" target="_parent">Section 2</a></li>
            <li class="li-menu"><a href="SECTION3.html" id="sect3">Section 3</a></li>
            <li class="li-menu"><a href="SECTION4.html" id="sect4">Section 4</a></li>
            <li class="li-menu"><a href="SECTION5.html" id="sect5">Section 5</a></li>
            <li class="li-menu"><a href="validateform.html" id="sect6">Section 6</a></li>
        </ul>


    </div>
    <div id="content" name="con">
   
          <div class="left">


     </div>
        <div class="right">


        </div>
    </div>
    <div class="footer">


    </div>

CSS File.
CSS
body {
}
* {
    margin:0px;
    padding:0px;
}
.header {
    height:70px;
    width:100%;
    background-color:brown;
}
.left {
    float:left;
    height:500px;
    width:10%;
    background-color:burlywood;
}
.right {
    float:right;
    height:500px;
    width:10%;
    background-color:burlywood;
}

.footer {
       height:70px;
       width:100%;
       clear:both;
       background-color:brown;
}
.ul-menu
{
    list-style-type:none;
}
.li-menu,a {
    float:left;
    text-decoration:none;
    font-size:large;
    margin-top:10px;
    margin-left:10px;
    padding-left:10px;
    color:yellow;
}
    .li-menu, a:hover {
        text-decoration:underline;
    }

SECTION 1.html
HTML
<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="utf-8" />
    <script>
 //  alert(checkbox);

        //    if (confirm("Are U Sure Want To Delete") == true)
        //    {
        //        var i = r.parentNode.parentNode.rowIndex;
        //        document.getElementById("tbl").deleteRow(i);
        //    }
        //    else { alert("Ok"); }
        //}

        function addrow(row) {
            var name = prompt("Enter Name ");
            var table = document.getElementById("tbl");
            var row = table.insertRow();
            var cell1 = row.insertCell(0);
            var cell2 = row.insertCell(1);
            var cell3 = row.insertCell(2);
            cell1.innerHTML = "<input type='checkbox' name='foo'/>";
            cell2.innerHTML = name;
            cell3.innerHTML = "<input type='button' value='delete'  onclick='delRow(this)' >";
        }

        //function selectall(source) {
        //    var checkboxes = document.getElementsByName("foo");

        //    for (var i = 0, n = checkboxes.length; i < n; i++) {
        //        if (checkboxes[i].type == 'checkbox')
        //        {
        //            checkboxes[i].checked = true;
        //        }
        //        else {
        //            checkboxes[i].checked = false;
        //        }
        //    }
        //}


        function deleteall(source) {
            var checkboxes = document.getElementsByName("foo");

            for (var i = 0, n = checkboxes.length; i < n; i++)
            {
                if (checkboxes[i].type == 'checkbox')
                {
                    checkboxes[i].checked = true;
                }
            }
                    if (checkboxes[i].checked == true)
                    {
                       // alert("You select all");
                        var ans = confirm("Are U Sure Delete Whole Record");
                        if (ans == true)
                        {
                            var i = source.parentNode.parentNode.rowIndex;
                            document.getElementById("tbl").deleteRow(i);
                        }
                        else
                        {
                            alert("Sorry Tray Again!....");
                        }
                    }
                }
            
        


        function delRow(r) {
            if (confirm("Are U Sure Want To Delete") == true)
            {
                var checkbox = document.getElementById("ch");
                if (checkbox.type == 'checkbox')
                {
                    if (checkbox.checked == true)
                    {
                        alert("Ok");
                        var i = r.parentNode.parentNode.rowIndex;
                       document.getElementById("tbl").deleteRow(i);
                    }
                    else
                    {
                        alert("Sorry");
                    }
                }
            }
        }


    </script>
</head>
<body>
    <center> <INPUT type="button" value="Add Row" onclick="addrow('tbl')" /></center>
    <br />
    <table border="1" align="center" id="tbl">
        <tr>
            <th><input type="checkbox" onclick="return deleteall(this)" /></th>
            <th>Name</th>
            <th>Action</th>
        </tr>
        <tr>
            <td><input type="checkbox" align="center" id="ch" name="foo" /></td>
            <td>viral</td>
            <td><input type="button" id="del" value="delete" onclick="delRow(this)" /></td>
        </tr>
        <tr>
            <td><input type="checkbox" align="center"  id="ch" name="foo" /></td>
            <td>vivek</td>
            <td><input type="button" id="del" value="delete" onclick="delRow(this)" /></td>
        </tr>
        <tr>
            <td><input type="checkbox" align="center"  id="ch" name="foo" /></td>
            <td>ram</td>
            <td><input type="button" id="del" value="delete" onclick="delRow(this)" /></td>
        </tr>
    </table>

</body>
</html>


Thank You :)
Posted
v2

Read out this: http://api.jquery.com/load/[^]
You need to run it in a web server for the Ajax to work.
 
Share this answer
 
Use jQuery's load function

http://api.jquery.com/load/[^]
 
Share this answer
 
Comments
ViralPatva 15-Dec-15 0:38am    
Thanks Tadit Dash
ViralPatva 15-Dec-15 0:38am    
Thanks F-ES Sitecore

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900