|
|
Post a Project »
Find a Professional HTML Freelancer!
Find a Freelancer to help you with your HTML projects
| |
|
 |
|
|
09-10-2006, 06:55 PM
|
open a new window help
|
Posts: 674
Name: James
Location: KENT
|
basically what i want do is have a link when u click it it gives u more information about the advert so it open the informaiton in a new window but i dont want it to be a full size window want it to open a new box about halfthe size of a full page if that makes sense
|
|
|
|
09-10-2006, 07:41 PM
|
Re: open a new window help
|
Posts: 11
|
Step 1 - add the following code between the head tags
Code:
<script language="javascript">
<!--
/*
Auto center window
*/
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
Last Step.
This will create a link
HTML Code:
<a href="http://www.yourlinkhere.com" onclick="NewWindow(this.href,'name','300','248','yes');return false" onMouseOut="MM_swapImgRestore()">Click Here</a>
Config.
1. replace yourlinkhere with the link you want to open in the new window.
2. replace 300 , 248 with the window size you want. w300 h248
|
|
|
|
09-11-2006, 05:45 AM
|
Re: open a new window help
|
Posts: 674
Name: James
Location: KENT
|
thanks for that is there a way the window can be a fixed size tho so it dont have the scroll bars so basically it just open a square box that u cant scroll on
|
|
|
|
09-11-2006, 08:32 AM
|
Re: open a new window help
|
Posts: 11
|
Sure thing.
Look at the last step for the following
this.href,'name','300','248','yes'
Adjust 300 and 248 to meet your size requirements.
300 is the width and 248 is the height.
If you set it up correctly you wont have to worry about a scroll bar. However, Changing yes to no will remove the scroll bar.
|
|
|
|
09-13-2006, 02:58 AM
|
Re: open a new window help
|
Posts: 39
Name: Hashim
Location: Aligarh
|
If you use Dreamweaver 8, you can add that thru Behaviours tab > Open Browser Window, in that you can specify the size of the new window. Quite simple and hassle free. No code required.
|
|
|
|
09-13-2006, 03:51 AM
|
Re: open a new window help
|
Posts: 45
Name: Terry
|
You should use Dreamweaver it very google for web design and coding.
|
|
|
|
09-13-2006, 05:27 PM
|
Re: open a new window help
|
Posts: 10,017
Location: Tennessee
|
Yep.. and anyone with the popup blocker turned on will never see your popup window.
Opening new windows is considered rude by usability standards. People use the back button and windows opening up tends to confuse people, and others (like me) downright hate it when a web site does this.
Opening new windows is also bad for accessiblity.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
Please login or register to view this content. Registration is FREE
Please login or register to view this content. Registration is FREE
|
|
|
|
09-13-2006, 07:53 PM
|
Re: open a new window help
|
Posts: 43
|
Code:
<script> win=window.open("http://www.youuurl.com",'New Window',',left=50,top=0,width=290,height=380,scrollbars=1,resizable=1,status=1,menubar=0'); window.focus(); </script>
This code let you open a new window
|
|
|
|
09-13-2006, 09:13 PM
|
Re: open a new window help
|
Posts: 10,017
Location: Tennessee
|
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
Please login or register to view this content. Registration is FREE
Please login or register to view this content. Registration is FREE
|
|
|
|
09-14-2006, 09:47 AM
|
Re: open a new window help
|
Posts: 11
|
Very true. Folks who use pop-up blockers will not see the window. Since it’s a clickable link you may want to let your visitors know to turn off their pop-up blocker.
As for it being rude. Naw missy, it’s not rude. The person asking the question did not specify what the new window was for. It could be for an image. Ya know, some folks like to create photo albums with thumbnails and use a pop-up to show case the main image.
Could be added information the web master would like to provide his/her visitor. Maybe a help center or some important information.
The “ rude “ pop-ups are when you enter a site and they automatically start popping-up. Usually advertisement ad's
Also - you want to include a close window option on any rezied window so the confused can close it with out clicking the X..lol
Quote:
Originally Posted by LadynRed
Yep.. and anyone with the popup blocker turned on will never see your popup window.
Opening new windows is considered rude by usability standards. People use the back button and windows opening up tends to confuse people, and others (like me) downright hate it when a web site does this.
Opening new windows is also bad for accessiblity.
|
Last edited by Allenstudios; 09-14-2006 at 09:51 AM..
|
|
|
|
09-14-2006, 02:46 PM
|
Re: open a new window help
|
Posts: 10,017
Location: Tennessee
|
I guess you didn't read the articles on usability and accessibilty when it comes to new windows. There are other methods available. If you INSIST on using a new window, then it is recommended that you state on your page that clicking the new link will open a new window so people are forewarned.
I've watched people surf the web, watched how they deal with different usability issues.. just blithely opening up new windows bothers people.
Missy ???? Ok.. Junior.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
Please login or register to view this content. Registration is FREE
Please login or register to view this content. Registration is FREE
|
|
|
|
09-18-2006, 05:01 PM
|
Re: open a new window help
|
Posts: 41
Name: Patrick Masciocchi
Location: California
|
This may have already been answered, but if you want to customize this pop up yourself, use the Pop Up Window Generator located at Dynamic Drive:
http://dynamicdrive.com/dynamicindex8/popwin.htm
HTH
|
|
|
|
09-19-2006, 11:53 AM
|
Re: open a new window help
|
Posts: 39
Name: Hashim
Location: Aligarh
|
HTML Code:
<body onload="MM_openBrWindow('http://linkurlhere/','','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=640,height=480')">
|
|
|
|
|
« Reply to open a new window help
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|