Wildfire563
06-24-2005, 12:52 AM
http://www.dynamicdrive.com/dynamicindex17/dropinbox.htm
Drop-in Content box
Ok, I've answered some of my own questions, but I still am totally lost when it comes to programming in javascript. I have a lot of Fortran experience, and a smidgen of C, and a good background in basic HTML, but no java.
So here is what I've got so far. I was able to figure out how to get rid of the bounce, and I think I figured out how to not have the content window open on page load (it didn't seem to work on the page I created anyway, but now I think I've explicitly removed it). Now what I am looking to do is pass a variable to an iframe in the DIV section so that it opens the page from a selected link. Is this possible?
If there is an easier way to do what I am trying to do I'd love to hear it.
Here is the code as I've modified it so far -
In the head section:
<script language="JavaScript1.2">
// Drop-in content box- By Dynamic Drive
// For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
// This credit MUST stay intact for use
//Modified 05/06/23 by Thomas Perry - removed bounce and load on pageload
var ie=document.all
var dom=document.getElementById
var ns4=document.layers
var calunits=document.layers? "" : "px"
var doctoload="Win_About.htm"
function initbox(){
if (!dom&&!ie&&!ns4)
return
crossobj=(dom)?document.getElementById("dropin").style : ie? document.all.dropin : document.dropin
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
crossobj.top=scroll_top-250+calunits
crossobj.visibility=(dom||ie)? "visible" : "show"
dropstart=setInterval("dropin()",50)
}
function dropin(){
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
if (parseInt(crossobj.top)<100+scroll_top)
crossobj.top=parseInt(crossobj.top)+200+calunits
else{
clearInterval(dropstart)
}
}
function dismissbox(){
crossobj.visibility="hidden"
}
function redo(){
initbox()
}
function truebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
</script>
And then in the Body
</div>
<div id="dropin" style="position:absolute;visibility:hidden;left:210px;top:200px;width:550px;height:760px;background-color:rgb(222,222,222)">
<div align="right"><a href="#" onClick="dismissbox();return false">[Close Box] </a></div>
<iframe src="Win_About.htm" width="100%" height="100%" frameborder="0"></iframe>
</div>
</body>
What I'm thinking is something like this, but I don't know how to do it, or if it is possible
I'll have two links something like:
<p><a href="javascript:redo(doctoload="Win_about.htm")">About</a></p>
<p><a href="javascript:redo(doctoload="Win_cal.htm")">Calendar</a></p>
And I want to pass doctoload to the iframe src in the above DIV. I realize my nomenclature is way off, but hopefully you can understand what I am trying to do. Is this possible?
My other questions still are out there:
Is it possible to round the corners of a content box?
What browsers do iframes not work in?
And a new one:
What is a content box? I've been using it, but I don't know what it is :-) I'm thinking if I understand more about what it is, I can figure out how to round the corners.
Thanks,
Thomas
Drop-in Content box
Ok, I've answered some of my own questions, but I still am totally lost when it comes to programming in javascript. I have a lot of Fortran experience, and a smidgen of C, and a good background in basic HTML, but no java.
So here is what I've got so far. I was able to figure out how to get rid of the bounce, and I think I figured out how to not have the content window open on page load (it didn't seem to work on the page I created anyway, but now I think I've explicitly removed it). Now what I am looking to do is pass a variable to an iframe in the DIV section so that it opens the page from a selected link. Is this possible?
If there is an easier way to do what I am trying to do I'd love to hear it.
Here is the code as I've modified it so far -
In the head section:
<script language="JavaScript1.2">
// Drop-in content box- By Dynamic Drive
// For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
// This credit MUST stay intact for use
//Modified 05/06/23 by Thomas Perry - removed bounce and load on pageload
var ie=document.all
var dom=document.getElementById
var ns4=document.layers
var calunits=document.layers? "" : "px"
var doctoload="Win_About.htm"
function initbox(){
if (!dom&&!ie&&!ns4)
return
crossobj=(dom)?document.getElementById("dropin").style : ie? document.all.dropin : document.dropin
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
crossobj.top=scroll_top-250+calunits
crossobj.visibility=(dom||ie)? "visible" : "show"
dropstart=setInterval("dropin()",50)
}
function dropin(){
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
if (parseInt(crossobj.top)<100+scroll_top)
crossobj.top=parseInt(crossobj.top)+200+calunits
else{
clearInterval(dropstart)
}
}
function dismissbox(){
crossobj.visibility="hidden"
}
function redo(){
initbox()
}
function truebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
</script>
And then in the Body
</div>
<div id="dropin" style="position:absolute;visibility:hidden;left:210px;top:200px;width:550px;height:760px;background-color:rgb(222,222,222)">
<div align="right"><a href="#" onClick="dismissbox();return false">[Close Box] </a></div>
<iframe src="Win_About.htm" width="100%" height="100%" frameborder="0"></iframe>
</div>
</body>
What I'm thinking is something like this, but I don't know how to do it, or if it is possible
I'll have two links something like:
<p><a href="javascript:redo(doctoload="Win_about.htm")">About</a></p>
<p><a href="javascript:redo(doctoload="Win_cal.htm")">Calendar</a></p>
And I want to pass doctoload to the iframe src in the above DIV. I realize my nomenclature is way off, but hopefully you can understand what I am trying to do. Is this possible?
My other questions still are out there:
Is it possible to round the corners of a content box?
What browsers do iframes not work in?
And a new one:
What is a content box? I've been using it, but I don't know what it is :-) I'm thinking if I understand more about what it is, I can figure out how to round the corners.
Thanks,
Thomas