mas_lerdanch
12-08-2008, 11:16 AM
http://www.walterdecantelupe.co.uk/new/ajax-dynamic-content.html
I have been working on calling external html files into divs on another page and can't seem to get it right! I can't see what I am doing wring here! Please help.
Cheers - Mas:confused:
The original files are available here http://www.dhtmlgoodies.com/scripts/ajax-dynamic-content/ajax-dynamic-content.zip
Html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Ajax dynamic content</title>
<style type="text/css">
/* This css is only needed for the demo */
body{
margin:10px;
font-size:0.9em;
font-family: Trebuchet MS, Lucida Sans Unicode, Arial, sans-serif;
text-align:center;
background-color:#E2EBED;
height:100%;
}
a{
color:#F00;
}
#mainContainer{
width:760px;
margin:0 auto;
text-align:left;
background-color:#FFF;
height:100%;
padding-bottom:10px;
}
#mainContainer .news{
margin:5px;
border:1px dotted #555;
background-color:#EEE;
padding:10px;
}
#mainContainer img{
float:left;
margin:2px;
}
div#header{
border:0px;
background-color:#FFF;
padding:0px;
margin:0px;
height:100px;
}
h2{
font-size:1.3em;
margin-bottom:5px;
}
p{
margin-top:0px;
}
.clear{
clear:both;
}
h2{
color:#000;
}
#news2{
height:150px;
}
.header{
padding-left:5px;
font-weight:bold;
}
</style>
<script type="text/javascript" src="http://www.walterdecantelupe.co.uk/new/js/ajax.js"></script>
<script type="text/javascript" src="http://www.walterdecantelupe.co.uk/new/js/ajax-dynamic-content.js"></script>
<script type="text/javascript">
ajax_loadContent('news1','http://www.walterdecantelupe.co.uk/new/external/externalfile1.html');
ajax_loadContent('news2','http://www.walterdecantelupe.co.uk/new/external/externalfile2.html');
ajax_loadContent('news3','http://www.walterdecantelupe.co.uk/new/external/externalfile3.html');
</script>
</head>
<body>
<div id="mainContainer">
<p class="header">The content of the three boxes below are loaded by Ajax(Asyncron Javascript And XML) from external files.</p>
<div class="news" id="news1"></div>
<div class="news" id="news2"></div>
<div class="news" id="news3"></div>
</div>
</body>
</html>
I have been working on calling external html files into divs on another page and can't seem to get it right! I can't see what I am doing wring here! Please help.
Cheers - Mas:confused:
The original files are available here http://www.dhtmlgoodies.com/scripts/ajax-dynamic-content/ajax-dynamic-content.zip
Html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Ajax dynamic content</title>
<style type="text/css">
/* This css is only needed for the demo */
body{
margin:10px;
font-size:0.9em;
font-family: Trebuchet MS, Lucida Sans Unicode, Arial, sans-serif;
text-align:center;
background-color:#E2EBED;
height:100%;
}
a{
color:#F00;
}
#mainContainer{
width:760px;
margin:0 auto;
text-align:left;
background-color:#FFF;
height:100%;
padding-bottom:10px;
}
#mainContainer .news{
margin:5px;
border:1px dotted #555;
background-color:#EEE;
padding:10px;
}
#mainContainer img{
float:left;
margin:2px;
}
div#header{
border:0px;
background-color:#FFF;
padding:0px;
margin:0px;
height:100px;
}
h2{
font-size:1.3em;
margin-bottom:5px;
}
p{
margin-top:0px;
}
.clear{
clear:both;
}
h2{
color:#000;
}
#news2{
height:150px;
}
.header{
padding-left:5px;
font-weight:bold;
}
</style>
<script type="text/javascript" src="http://www.walterdecantelupe.co.uk/new/js/ajax.js"></script>
<script type="text/javascript" src="http://www.walterdecantelupe.co.uk/new/js/ajax-dynamic-content.js"></script>
<script type="text/javascript">
ajax_loadContent('news1','http://www.walterdecantelupe.co.uk/new/external/externalfile1.html');
ajax_loadContent('news2','http://www.walterdecantelupe.co.uk/new/external/externalfile2.html');
ajax_loadContent('news3','http://www.walterdecantelupe.co.uk/new/external/externalfile3.html');
</script>
</head>
<body>
<div id="mainContainer">
<p class="header">The content of the three boxes below are loaded by Ajax(Asyncron Javascript And XML) from external files.</p>
<div class="news" id="news1"></div>
<div class="news" id="news2"></div>
<div class="news" id="news3"></div>
</div>
</body>
</html>