If you give up the idea of a form with an upload field, then you could do the following (without even using Ajax):
File in which you want to do the updates:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<title></title>
<script type="text/javascript">
function checkIframeLoading()
{
if(frames['iframe'].document.readyState == 'complete' )
{
if(document.readyState=='complete' )
{
setTimeout("document.getElementById('updated_text').innerHTML=frames['iframe'].document.getElementById('external_text').innerHTML",0)
setTimeout("document.getElementById('updated_image').innerHTML=frames['iframe'].document.getElementById('external_image').innerHTML",0)
}
}
//check again after 10 millisecs if iframe is loaded
window.setTimeout('checkIframeLoading()', 10);
}
setTimeout("frames['iframe'].location.replace('external.html')", 0);
setTimeout(checkIframeLoading,0)
</script>
</head>
<body><iframe name="iframe" style="position:absolute; visibility: hidden; left: -10000px"></iframe>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
<br><br>
<div id="updated_text" style="border: 2px solid red; text-align: center"></div><br>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
<br><br>
<div id="updated_image"></div><br>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
<br>
</body>
</html>
external.html: the file used for doing the updates
Code:
<div id="external_text">This is text from <i>external.html</i></div><br>
<div id="external_image">This is an image from <i>external.html</i> → <img src="http://www.google.com/intl/nl_ALL/images/logos/images_logo_lg.gif" width="200" height="100" border="1" title="" alt=""></div> contained in <i>external.html</i>
Now each time you change the text wrapped in div id="external_text" and/or the image in div id="external_image (second file), the changes will be updated in the main file.
===
Arie Molendijk.
Bookmarks