Trying to put an html file in div tags. It works if I use method get but want post. It also works if the extension of the filename "fn" that goes to f() is cfm instead of html.
What am I doing wrong?
This is the dtry.html that sets up the screen and tries to put dtry1.html (further down) into the div area "content".
Below is dtry1.html I want inside the div "content" is here.
What am I doing wrong?
This is the dtry.html that sets up the screen and tries to put dtry1.html (further down) into the div area "content".
Code:
<html>
<head>
<title>
</title>
<script type="text/javascript">
function f(fn,dn)
{
var req=false;
if (window.XMLHttpRequest)
req=new XMLHttpRequest()
else
if (window.ActiveXObject)
req=new ActiveXObject("Microsoft.XMLHTTP");
if (req)
{
req.open("POST",fn,true);
req.setRequestHeader("Content-type","application/x-[URL unfurl="true"]www-form-urlencoded");[/URL]
req.onreadystatechange=function()
{
if (req.readyState==4 && req.status==200)
{
document.getElementById(dn).innerHTML=req.responseText;
delete req;
req=null
}
};
req.send()
}
else
{
alert('No req.');
return false
};
}
function aa()
{
alert('*')
}
</script>
/*style sheet part goes here*/
</head>
<body>
<div id="outer">
<div id="header1">
</div>
<div id="header2">
</div>
<div id="sider">
<a href="#" id="a2" onclick="f('dtry1.html','content');">
click
</a>
</div>
<div id="content">
Content
</div>
<div id="footer">
Footer
</div>
</div>
</body>
</html>
Code:
<html>
<head>
<title>
</title>
</head>
<body>
<a href="#" id="aa" onclick="aa();"> /*works if aa() in file with f()*/
click
</a>
<form>
<input name="bb" type="submit" value="click" onclick="f('dtry2.html','content');">
</form>
</body>
</html>