Src attribute possible?

liunx

Guest
I have a page that is using an iframe right now and want to take it out. So I am using css
<style type="text/css">
#update
{
position:absolute;
left: 30px;
top: 200px;
}
</style>

I was wondering if it was possible to set the div so that it would display what was in a file. I doubt that SSI is avalible.CSS can't include files. HTML can't include files. Only the server, or a browser can. And, no, I a browser won't include a file referenced to in that matter from a CSS document, nor from an HTML document. (In XHTML 2 you can do this, but since the spec isn't complete and browser support is zilch, that's not relevant). Any decent host will have SSI, or a server side language you can use.Originally posted by MstrBob
HTML can't include files.Actually, HTML can but browsers never got around to supporting the feature. In XHTML - be it 1.0, 1.1 or 2.0 - it is better suported.

<!ENTITY menu SYSTEM 'menu.html'>Originally posted by Charles
Actually, HTML can but browsers never got around to supporting the feature. In XHTML - be it 1.0, 1.1 or 2.0 - it is better suported.

<!ENTITY menu SYSTEM 'menu.html'>

Really? I didn't know that. Where would one find that in the specs? I've never really worked with DTD's, but that looks reminiscent of what goes into one.I second that! :D Do you have a page that explains it? I don't really know what !Entity and the rest mean. Thanks.It's described in the XML 1.0 Spec. ( <!-- m --><a class="postlink" href="http://www.w3.org/TR/1998/REC-xml-19980210">http://www.w3.org/TR/1998/REC-xml-19980210</a><!-- m --> ) but you've already read the HTML 4.01 Spec ( <!-- m --><a class="postlink" href="http://www.w3.org/TR/html401/intro/sgmltut.html#h-3.3">http://www.w3.org/TR/html401/intro/sgmltut.html#h-3.3</a><!-- m --> ) and just forgot about that part.Using JavaScript you can reset the contents like so:

function getFile(fileName){
oxmlhttp = null;
try{
oxmlhttp = new XMLHttpRequest();
oxmlhttp.overrideMimeType("text/xml");
}
catch(e){
try{
oxmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e){
return null;
}
}
if(!oxmlhttp) return null;
try{
oxmlhttp.open("GET",fileName,false);
oxmlhttp.send(null);
}
catch(e){
return null;
}
return oxmlhttp.responseText;
}
....

document.getElementById("chgDiv").innerHTML=getFile("NewPage.htm);
...

<div id="chgDiv"></div>
..Save the following with a ".xml" extension to make it known that the page is XML and not HTML and then view it in MSIE:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" [

<!ENTITY foo '<h3>Foo</h3>'>
<!ENTITY menu SYSTEM 'http://www.saintjohns.ang-md.org/menu.html'>

]>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Example</title>
</head>
<body>
&foo;
&menu;
</body>
</html>

Because of its spotty support you can't really use external entities on the web but I have a lot of fun using them for my own purposes. If I want to publish something I just run it through Xalan ( <!-- m --><a class="postlink" href="http://xml.apache.org/">http://xml.apache.org/</a><!-- m -->) first.Originally posted by TheBearMay
Using JavaScript you can reset the contents like so:

function getFile(fileName){
oxmlhttp = null;
try{
oxmlhttp = new XMLHttpRequest();
oxmlhttp.overrideMimeType("text/xml");
}
catch(e){
try{
oxmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e){
return null;
}
}
if(!oxmlhttp) return null;
try{
oxmlhttp.open("GET",fileName,false);
oxmlhttp.send(null);
}
catch(e){
return null;
}
return oxmlhttp.responseText;
}
....

document.getElementById("chgDiv").innerHTML=getFile("NewPage.htm);
...

<div id="chgDiv"></div>
.. That's not JavaScript, it's JScript and you'll find that it's not supported well enough to use on the web. It's even less well supported than the method I've described above.Call it what you will, it runs under FireFox and IE....Originally posted by TheBearMay
Call it what you will, it runs under FireFox and IE.... MSIE and Mozilla represent 94% ( <!-- m --><a class="postlink" href="http://www.thecounter.com/stats/2004/November/browser.php">http://www.thecounter.com/stats/2004/No ... rowser.php</a><!-- m --> ) of the market, yet 10% ( <!-- m --><a class="postlink" href="http://www.thecounter.com/stats/2004/November/javas.php">http://www.thecounter.com/stats/2004/November/javas.php</a><!-- m --> ) of users do not use JavaScript. That means a great number of MSIE and Mozilla users disable scripting.

If we are generous and allow that your method works for everybody who uses JavaScript 1.2 then you've only covered 90% of the market. The method I've demonstrated works for 91%. Neither, however, should be used on the web.Another tag that is sometimes overlooked is the Object tag:


<object data="embeddedDoc.htm" height="50%" width="100%">
Error embedding document <a href=http://www.webdeveloper.com/forum/archive/index.php/"embeddedDoc.htm">Embedded Document</a>
</object>However object is a replaced element you could say iframe but quite seriously they are both different kettle of fish.Originally posted by Robert Wellock
However object is a replaced element you could say iframe but quite seriously they are both different kettle of fish.

That is my understanding also...Don't worry it never got off the ground for HTML.
 
Back
Top