Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 DEV-Group
 DEV Discussions (General)
 javascript - openwindow
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

redbrad0
Advanced Member

USA
3725 Posts

Posted - 25 July 2002 :  00:43:17  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
In v 3.4 Is it still set to open up new windows using 5 functions? If so, why not just make it one function?

example using one function for all popups

function openWindow(url, height, width, resizable, scrollbars) {
popupWin = window.open(url,'page','height='+height+',width='+width+',resizable='+resizable+',scrollbars='+scrollbars+'')
}


Brad
Web Hosting with SQL Server @ $24.95 per month

Spoon
Average Member

Ireland
507 Posts

Posted - 25 July 2002 :  18:42:52  Show Profile  Visit Spoon's Homepage  Send Spoon an ICQ Message
quote:

In v 3.4 Is it still set to open up new windows using 5 functions? If so, why not just make it one function?

example using one function for all popups

function openWindow(url, height, width, resizable, scrollbars) {
popupWin = window.open(url,'page','height='+height+',width='+width+',resizable='+resizable+',scrollbars='+scrollbars+'')
}


The above is the way its always been, they are just different size windows

Brad
Web Hosting with SQL Server @ $24.95 per month




Regards - Spoon

Beginner? Need help installing the forums? - www.aslickpage.com/snitz_help.html

www.ASlickPage.com - Private Messaging
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 25 July 2002 :  19:01:20  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
Im looking in inc_top.asp file on v3.3.05 and this is what i see....


<script language="JavaScript">
<!-- hide from JavaScript-challenged browsers
function openWindow(url) {
popupWin = window.open(url,'new_page','width=400,height=400')
}
function openWindow2(url) {
popupWin = window.open(url,'new_page','width=400,height=450')
}
function openWindow3(url) {
popupWin = window.open(url,'new_page','width=400,height=450,scrollbars=yes')
}
function openWindow4(url) {
popupWin = window.open(url,'new_page','width=400,height=525')
}
function openWindow5(url) {
popupWin = window.open(url,'new_page','width=450,height=525,scrollbars=yes,toolbars=yes,menubar=yes,resizable=yes')
}
// done hiding -->
</script>


im saying combine all of these functions into one function.

Brad
Web Hosting with SQL Server @ $24.95 per month
Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 25 July 2002 :  19:38:33  Show Profile  Visit dayve's Homepage
I agree with redbrad0, I also think that adding a feature to center
it based on resolution would be an easy add and much desired. I've
started doing that on my demo site and will be live very soon.


<script>
/*
Auto center window script- Eric King (http://redrival.com/eak/index.shtml)
Permission granted to Dynamic Drive to feature script in archive
For full source, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
*/
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)
}

</script>


and then call the windows using this:


<a href="http://wsabstract.com" onclick="NewWindow(this.href,'name','400','400','yes');return false">Website Abstraction</a>





http://www.nineinchnailz.com

Edited by - dayve on 25 July 2002 19:38:56
Go to Top of Page

Spoon
Average Member

Ireland
507 Posts

Posted - 28 July 2002 :  13:41:48  Show Profile  Visit Spoon's Homepage  Send Spoon an ICQ Message
hmm think i was drunk when i posted that rubbish above..... i think its a great idea, reduces the amount of code and speeds up things for everybody

Go to Top of Page

Davio
Development Team Member

Jamaica
12217 Posts

Posted - 28 July 2002 :  15:34:39  Show Profile
It's a great idea to reduce it to one function. It would be less coding.

But then again, when i want to change or modify one of the pop_up windows, I will have to go searching through the code to find the link to modify it. As with the way it is, all I need to do is edit inc_top since all the functions are in one place. This is looking from a beginners point of view. If there was some gain for the forum apart from less coding (it just takes up 14 lines of code), then it would be something to consider. I think it would be a bit harder for new users who want to modify thier code.

«------------------------------------------------------»
What new features are going to be in the 3.4
version? See the 3.4 UnOfficial Features List !
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 29 July 2002 :  20:58:11  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
Davio,

Yes you are correct about the new users part, but how often do you think people want to change the popup size? I really think it would be in odd cases. I like it better the way I posted it because I think its cleaner code, and when I want to popup a window for another page (not on the snitz forums) then I dont want to add a new function for each different size i want to popup.

Brad
Web Hosting with SQL Server @ $24.95 per month
Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 29 July 2002 :  21:32:52  Show Profile  Visit dayve's Homepage
quote:

I think it would be a bit harder for new users who want to modify thier code.



I think we should give new users more credit than that. every time there is a
new mod that incorporates a new popup window they would have to add a function
in inc_top.asp and in the code where the feature exists whereas with the one
I have shown its a done deal, all they need to do is add the code where the
feature exists and they control the size of the window very easily.

and we're forgetting one very other cool feature.. Auto Centering!! I really
can't imagine anything else simpler than this.

and as Forrest Gump would say "that's all I have to say about that"


http://www.nineinchnailz.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.83 seconds. Powered By: Snitz Forums 2000 Version 3.4.07