-
September 13th, 2002, 09:01 PM
#1
Junior Member
html help please please
can anyone tell me how to open a small window as a webpage page loads, using just only html and no javascript! please help thanks!
-
September 13th, 2002, 09:16 PM
#2
Banned
Thats impossible.... Maybe you cand o something with DHTML but its unlikely... Let me search and ill get back to you
Ok, I got something for you.....
Step 1: Add the following script into the <HEAD> section of your page:
Code:
<script>
//DHTML Window script- Copyright Dynamic Drive (http://www.dynamicdrive.com)
//For full source code, documentation, and terms of usage,
//Visit http://www.dynamicdrive.com/dynamici...htmlwindow.htm
var dragapproved=false
var minrestore=0
var initialwidth,initialheight
var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all
function drag_drop(e){
if (ie5&&dragapproved&&event.button==1){
document.getElementById("dwindow").style.left=tempx+event.clientX-offsetx
document.getElementById("dwindow").style.top=tempy+event.clientY-offsety
}
else if (ns6&&dragapproved){
document.getElementById("dwindow").style.left=tempx+e.clientX-offsetx
document.getElementById("dwindow").style.top=tempy+e.clientY-offsety
}
}
function initializedrag(e){
offsetx=ie5? event.clientX : e.clientX
offsety=ie5? event.clientY : e.clientY
if (ie5)
document.getElementById("saver").style.display=''
tempx=parseInt(document.getElementById("dwindow").style.left)
tempy=parseInt(document.getElementById("dwindow").style.top)
dragapproved=true
document.onmousemove=drag_drop
}
function loadwindow(url,width,height){
if (!ie5&&!ns6)
window.open(url,"","width=width,height=height,scrollbars=1")
else{
document.getElementById("dwindow").style.display=''
document.getElementById("dwindow").style.width=initialwidth=width
document.getElementById("dwindow").style.height=initialheight=height
document.getElementById("dwindow").style.left=30
document.getElementById("dwindow").style.top=ns6? window.pageYOffset*1+30 : document.body.scrollTop*1+30
document.getElementById("cframe").src=url
}
}
function maximize(){
if (minrestore==0){
minrestore=1 //maximize window
document.getElementById("maxname").setAttribute("src","restore.gif")
document.getElementById("dwindow").style.width=ns6? window.innerWidth-20 : document.body.clientWidth
document.getElementById("dwindow").style.height=ns6? window.innerHeight-20 : document.body.clientHeight
}
else{
minrestore=0 //restore window
document.getElementById("maxname").setAttribute("src","max.gif")
document.getElementById("dwindow").style.width=initialwidth
document.getElementById("dwindow").style.height=initialheight
}
document.getElementById("dwindow").style.left=ns6? window.pageXOffset : document.body.scrollLeft
document.getElementById("dwindow").style.top=ns6? window.pageYOffset : document.body.scrollTop
}
function closeit(){
document.getElementById("dwindow").style.display="none"
}
if (ie5||ns6)
document.onmouseup=new Function("dragapproved=false;document.onmousemove=null;document.getElementById('saver').style.display='none'")
</script>
Step 2: Add the below to the <BODY> section, preferably at the end of the page:
Code:
<div id="dwindow" style="position:absolute;background-color:navy;cursor:hand;left:0;top:0;display:none" onMousedown="initializedrag(event)" onSelectStart="return false">
<div align="right">[img]max.gif[/img][img]close.gif[/img]</div>
<iframe id="cframe" src="" width=100% height=100%></iframe>
<div id="saver" style="width:100%;height:100%;position:absolute;left:0;top:0;display:none"></div>
</div>
<script>
//Use below code to load DHTML Window as page loads
if (ns6) window.onload=new Function('loadwindow("http://www.geocities.com",600,400)')
else
loadwindow("http://www.geocities.com",600,400)
</script>
Geocities
Thats the closest thing I could find.... It still uses JavaScript though
-
September 13th, 2002, 09:37 PM
#3
<A HREF="http://whatever you want" target="_blank">
what you want them to read</A>
or
<A HREF="http://whatever you want" target="_blank">
[img]here is my image.jpg[/img]
</A>
that SHOULD work for you...
just like water off a duck\'s back... I AM HERE.
for CMOS help, check out my CMOS tut?
-
September 13th, 2002, 10:29 PM
#4
qwerty_smith -- That's good code to open up a page in a separate browser window, but I think Yousefj32uk wanted something that would automatically open when you link to a separate page -- like a pop-up window. With javascript it would just be an onLoad call. With flat HTML -- it's not happening. DHTML will work, like ac1d said above, and perhaps XML (don't quote me on that, I don't know squat about XML).
/* You are not expected to understand this. */
-
September 14th, 2002, 01:36 AM
#5
hmmmm could be done with flash - that would require no java script
just use the one frame load command
v_Ln
-
September 14th, 2002, 04:42 AM
#6
Well i don't think there is a direct way you can open a page(pop up)with naked HTML!
you have to use one of these:
FLASH
JAVAscript
DHTML
there are other methods too but these are the most simple things you can use.
among these FLASH and javascript seem to be better,because most browser support them.
between FLASH and javascript FLASH is easer to handle.
----------------------------------------------------------------------------------------------------------------------
As far as the laws of mathematics refer to reality, they are not certain, and as far as they are certain, they do not refer to reality. -- Albert Einstein
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|