<?php
include "../../tryheader.php";
?>
<html>
<head>
<style type="text/css">
textarea, iframe
{
border: 2px solid green;
width: 100%;
height: 500px;
}
</style>
<title>Background-Image in HTML and CSS</title>
<meta name="description" content="Background-Image in HTML and CSS">
<meta name="keywords" content="Background-Image in HTML and CSS">
</head>
<body>
<h1>Background-Image in HTML and CSS</h1>
<table width="100%" cellspacing="4" cellpadding="4">
<tr>
<td width="50%" scope="col"> </td>
<td width="50%" align="left" scope="col">
<input onclick="runCode();" type="button" value="Run run">
</td>
</tr>
<tr>
<td>
<form>
<strong>SourceCode</strong>
<textarea name="sourceCode" id="sourceCode">
<html>
<head>
<style>
body {
background-image: url("logo.jpg");
}
</style>
</head>
<body>
<p>This page has an image as the background...</p>
</body>
</html>
</textarea>
</form>
</td>
<td><strong>Output</strong><iframe name="targetCode" id="targetCode"></iframe></td>
</tr>
</table>
<script type="text/javascript">
function runCode()
{
var content = document.getElementById('sourceCode').value;
var iframe = document.getElementById('targetCode');
iframe = (iframe.contentWindow) ? iframe.contentWindow : (iframe.contentDocument.document) ? iframe.contentDocument.document : iframe.contentDocument;
iframe.document.open();
iframe.document.write(content);
iframe.document.close();
return false;
}
runCode();
</script>
</body>
</html>
<?php
include "../../tryfooter.php";
?>