Create the Dynamic HTML window using Java Script

By Jignesh Shah

Hi Friends, I have written this JS script which creates eggheadcafe DHTML window. Your questions are most welcomed. -Jack

<HEAD>

<script language="javascript">

var IE_elements=document.all&&document.getElementById
var other_elements=document.getElementById&&!document.all
var flag=false var restore_flag=0 var wwidth,wheight function MyDragAndDrop(e){ if (IE_elements&&flag&&event.button==1){
document.getElementById("mywindow").style.left=tempx+event.clientX-offsetx+"px" document.getElementById("mywindow").style.top=tempy+event.clientY-offsety+"px" } else if (other_elements&&flag){
document.getElementById("mywindow").style.left=tempx+e.WinX-offsetx+"px" document.getElementById("mywindow").style.top=tempy+e.WinY-offsety+"px" } } function Window_Drag_Finished(){ flag=false;
document.getElementById("mywindow").onmousemove=null;
document.getElementById("mywindowcontent").style.display="" //extra } function checkIE(){ return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function Initialization(e){
offsetx=IE_elements? event.clientX : e.WinX
offsety=IE_elements? event.clientY : e.WinY
document.getElementById("mywindowcontent").style.display="none" //extra tempx=parseInt(document.getElementById("mywindow").style.left)
tempy=parseInt(document.getElementById("mywindow").style.top)
flag=true document.getElementById("mywindow").onmousemove=MyDragAndDrop
}

function Window_Load(url,width,height){
if (!IE_elements&&!other_elements)
window.open(url,"","width=width,height=height,scrollbars=1")
else{
document.getElementById("mywindow").style.display='' document.getElementById("mywindow").style.width=wwidth=width+"px" document.getElementById("mywindow").style.height=wheight=height+"px" document.getElementById("mywindow").style.left="30px" document.getElementById("mywindow").style.top=other_elements? window.pageYOffset*1+30+"px" : checkIE().scrollTop*1+30+"px" document.getElementById("cframe").src=url
}
}

function Window_Maximized(){
if (restore_flag==0){
restore_flag=1 //Window_Maximized window document.getElementById("maxname").setAttribute("src","restore.gif")
document.getElementById("mywindow").style.width=other_elements? window.innerWidth-20+"px" : checkIE().clientWidth+"px" document.getElementById("mywindow").style.height=other_elements? window.innerHeight-20+"px" : checkIE().clientHeight+"px" } else{
restore_flag=0 //restore window document.getElementById("maxname").setAttribute("src","max.gif")
document.getElementById("mywindow").style.width=wwidth
document.getElementById("mywindow").style.height=wheight
}
document.getElementById("mywindow").style.left=other_elements? window.pageXOffset+"px" : checkIE().scrollLeft+"px" document.getElementById("mywindow").style.top=other_elements? window.pageYOffset+"px" : checkIE().scrollTop+"px" } function Window_Close(){ document.getElementById("mywindow").style.display="none" } </script> </HEAD> <BODY> <div id="mywindow" style="position:absolute;background-color:#EBEBEB;cursor:hand;left:0px;top:0px;display:none" onMousedown="initializedrag(event)" onMouseup="Window_Drag_Finished()" onSelectStart="return false">
<div align="right" style="background-color:navy"><img src="max.gif" id="maxname" onClick="maximize()"><img src="close.gif" onClick="Window_Close()"></div>
<div id="mywindowcontent" style="height:100%">
<iframe id="cframe" src="" width=100% height=100%></iframe>
</div>
</div>

<script>
//load DHTML Window on page load if (other_elements) window.onload=new Function('Window_Load("http://www.eggheadcafe.com",600,400)')
else Window_Load("http://www.eggheadcafe.com",600,400)
</script>

<!--load DHTML window using link-->
<a href="javascript:loadwindow('http://www.eggheadcafe.com',600,400)"></a>
</BODY>
Popularity  (1611 Views)
Biography - Jignesh Shah
"I am electric engg and professor in college. Working on all the softwar languages are my passion." - Jignesh
Create New Account
Article Discussion: Create the Dynamic HTML window using Java Script
Jignesh Shah posted at Saturday, November 01, 2008 5:48 AM
reply
Jignesh Shah replied to Clark Kent at Wednesday, November 05, 2008 8:30 AM

Hello,

That article is not straightly taken. I worked on that and made the working version. You cannot say that it is copied version. If you have any questions then you can ask me on this. I will give you detailed answer. BTW, we are set of people who used this account to give the answers on our interest. I think eggheadcafe will not have any issues with this, do you have? I could see that you are not giving any answers and not helping people at all then why you are talking like this? Are you getting paid for this? I think you are making eggheadcafe polluted with your comments so you should be in blacklist. :-) Moderators are not illiterate who cannot see this. Lets moderators to decide, what to do.

-Jack

 

Now I Understood
Jignesh Shah replied to Clark Kent at Wednesday, November 05, 2008 8:30 AM

Megha is my Girlfriend and you have torched her mentally a lot. Just now I spoke with her and I came to know why she has asked me to use my account. But I am not cool mind like her and also I don’t want to speak any wrong words here like you. If you really want to speak with me then lets talks on Google or Yahoo chat. You ???? reply once and we will speak.

Waiting for you.

-Jack

Hello!
Stephen Bishop replied to Jignesh Shah at Wednesday, November 05, 2008 8:30 AM
I don't see a big deal. Jack, if you got it to work that is great! A lot of times you copy stuff from the internet "that works," you have to make it adapt to what you really need it to do.