Ik zit een Window System aan het maken met Dhtml en Javascript.
Nou heb ik een script gemaakt dat je Dynamisch een Window kan laten maken.
Maar nu het volgende probleem is dat ik niet via Javascript een functie kan instellen voor onmousedown en onmouseup.
Ik heb geprobeert met object.onmousedown en object.onmouseup en met object.setattribute maar dat werkt ook niet
als ik het zonder " doet dan worden ze aangezet maar dat wil ik niet.
hier heb ik alle Javascripting, het probleem is alles dat met // voor zit. Dat werkt niet
En zo maak je een venster aan
Kan me iemand me alsjeblieft met dit helpen zodat ik dynamisch gemaakte venster kan laten verschuiven in de pagina.
Nou heb ik een script gemaakt dat je Dynamisch een Window kan laten maken.
Maar nu het volgende probleem is dat ik niet via Javascript een functie kan instellen voor onmousedown en onmouseup.
Ik heb geprobeert met object.onmousedown en object.onmouseup en met object.setattribute maar dat werkt ook niet
als ik het zonder " doet dan worden ze aangezet maar dat wil ik niet.
hier heb ik alle Javascripting, het probleem is alles dat met // voor zit. Dat werkt niet
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
| var dragapproved=false
var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all
var DragWindow
function iecompattest(){
return (document.compatMode!="BackCompat")? document.documentElement : document.body
}
function stopdrag(WindowID){
dragapproved=false;
document.getElementById(WindowID).onmousemove=null;
document.getElementById(WindowID).style.filter = "Alpha(Opacity=100)"
// document.getElementById("dwindowcontent").style.display="" //extra
}
function drag_drop(e){
if (ie5&&dragapproved&&event.button==1){
document.getElementById(DragWindow).style.left=tempx+event.clientX-offsetx+"px"
document.getElementById(DragWindow).style.top=tempy+event.clientY-offsety+"px"
}
else if (ns6&&dragapproved){
document.getElementById(DragWindow).style.left=tempx+e.clientX-offsetx+"px"
document.getElementById(DragWindow).style.top=tempy+e.clientY-offsety+"px"
}
}
function initializedrag(e,WindowID){
offsetx=ie5? event.clientX : e.clientX
offsety=ie5? event.clientY : e.clientY
// document.getElementById("dwindowcontent").style.display="none" //extra
tempx=parseInt(document.getElementById(WindowID).style.left)
tempy=parseInt(document.getElementById(WindowID).style.top)
dragapproved=true
DragWindow=WindowID
document.getElementById(WindowID).style.filter = "Alpha(Opacity=80)"
document.getElementById(WindowID).onmousemove=drag_drop
}
function OpenWindow(WindowID){
document.getElementById(WindowID).style.display=""
}
function CloseWindow(WindowID){
document.getElementById(WindowID).style.display="none"
}
function MakeWindow(WindowID, Title, ContentID) {
this.newWindow = document.createElement("div");
this.newWindow.setAttribute("id", WindowID);
this.newWindow.setAttribute("onSelectStart","return false");
this.newWindow.className = "WindowArea";
this.newWindow.onSelectStart = "return false";
this.newWindow.style.width = "320px";
this.newWindow.style.height = "200px";
this.newWindowTitle = document.createElement("div");
this.newWindowTitle.className = "WindowTitle";
// this.newWindowTitle.setAttribute("onMouseup", stopdrag(WindowID), false);
// this.newWindowTitle.onMouseDown = "initializedrag(event ," + WindowID + ")";
// this.newWindowTitle.onMouseUp = "stopdrag(" + WindowID + ")";
// this.newWindowTitle.onMouseDown = initializedrag(event , WindowID);
// this.newWindowTitle.onMouseUp = stopdrag(WindowID);
this.newWindowTitle.innerHTML = "[img]'gfx/close.gif'[/img] " + Title;
this.newWindowTitle.onSelectStart = "return false";
this.newWindow.appendChild(this.newWindowTitle);
this.newWindowWorkspace = document.createElement("div");
this.newWindowWorkspace.className = "WindowWorkspace";
this.newWindowWorkspace.innerHTML = ContentID;
this.newWindow.appendChild(this.newWindowWorkspace);
document.body.appendChild(this.newWindow);
} |
En zo maak je een venster aan
code:
1
| MakeWindow('TestWin','Testing Dynamic Window', 'Content not found!') |
Kan me iemand me alsjeblieft met dit helpen zodat ik dynamisch gemaakte venster kan laten verschuiven in de pagina.
A random guy with a Computer.