phobia
Terugkerende gebruiker
- Lid geworden
- 4 sep 2006
- Berichten
- 1.777
ik heb een script, maar ik wil dat de div pas gevuld word als het script klaar is.
dit is wat ik gebruik
dit is wat ik gebruik
Code:
<HTML>
<HEAD>
<TITLE>Div's leren besturen JAVA</TITLE>
<style type="text/css">
.div {
filter: alpha(opacity=70); // IE syntax
-moz-opacity: .70; // Mozilla
opacity: .70; // De rest;
text-align: center;
color: white;
}
.style10 {
background-color: #FFFFFF;
font-family: "Agent Orange";
}
.style11 {
text-align: center;
}
</style>
<script type="text/javascript">
function getXMLHTTP() { //fuction to return the xml http object
var xmlhttp=false;
try {
xmlhttp=new XMLHttpRequest();
} catch(e) {
try {
xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
try{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e1) {
xmlhttp=false;
}
}
}
return xmlhttp;
}
function link(strURL) {
var req = getXMLHTTP(); // fuction to get xmlhttp object
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) { //data is retrieved from server
if (req.status == 200) { // which reprents ok status
document.getElementById('id').innerHTML=req.responseText;
} else {
alert("There was a problem while using XMLHTTP:\n");
}
}
}
req.open("GET", strURL, true); //open url using get method
req.send(null);
}
}
function toggle(id,x,y)
{
// ---- hoogte en breedte
var ie=document.all && !window.opera //
var iebody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
var x =(ie)? iebody.clientWidth : window.innerWidth // ----scherm breedte
var y=(ie)? iebody.clientHeight : window.innerHeight // ----scherm hoogte
x
var obj = document.getElementById(id);
if(obj.style.visibility == 'visible')
{
toggleObject(obj, true,x-3,y-3);
}else{
toggleObject(obj, false,x-3,y-3);
}
}
var inc = 10;
function toggleObject(obj,close,x,y)
{
var w, h, go;
w = parseInt(obj.style.width);
h = parseInt(obj.style.height);
go = false;
if(close === false)
{
obj.style.visibility = 'visible';
if(w < x)
{
obj.style.width = w + inc + 'px';
go = true;
}
if(h < y)
{
obj.style.height = h + inc + 'px';
go = true;
}
}else{
obj.innerHTML = "";
if(w > 0)
{
obj.style.width = w - inc + 'px';
go = true;
}
if(h > 0)
{
obj.style.height = h - inc + 'px';
go = true;
}
}
if(go === true)
{
var f = function(){ toggleObject(obj, close,x,y); }
setTimeout(f, 5);
}else{
if(close === true)
{
obj.style.visibility = 'hidden';
}
}
}
</script>
</HEAD>
<BODY>
<h1>Div sturen leren</h1>
<form id="form" >
<input id="x" type="text" value= "test">
<input type="button" value="Show DIV" onclick="toggle('id','600','150');link('test5.php');">
</form>
<div class="div" style="position: absolute; visibility: hidden; background-color: black; width: 0px; height: 0px; z-index: 1; left: 0px; top: 0px;" id="id">
</div>
<p>jfsakf;ajsf;jg;asf</p>
<p> </p>
<p>asdfhgasfgkasdv.sdv.c.sa</p>
</BODY>
</HTML>