|
You don't need a Crystal Ball |
![]() |
|
to Search for Files |
| SearchWin Home |
| Article Home |
| Web Forms |
| Borderless Windows |
| Cookies-Part One |
| Cookies-Part Two |
| About Span and Div. |
| Using CSS-Part 1 |
| Using CSS-Part 2 |
| Using CSS-Part 3 |
| About DOCTYPE |
| Tables With XML |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
| Welcome to the first round of Web Page Corner - a place
to share web page tips, tricks, ideas, how to's and anecdotes for
shareware developers who maintain their own web pages. The topics
discussed here are largely based on questions and suggestions presented in
the ASP.Members news group. I would like to encourage anyone who has a
question or topic suggestion to post to the news group or to email me. This issue's topic is Opening Borderless HTML Windows. I'm going to do a quick sidestep around the debate of the appropriateness of opening such windows as I think that is a matter for each web master to decide for their web pages. I think we've all stumbled on web sites who's use of this technique to open multiple windows and AD's is totally obnoxious. And some sites who's use is tastefully done, helpful and enhances the main web page that is open. I.M.H.O. two fundamental characteristics of a good use of this technique include: 1) the link should clearly indicate it opens a 'help / information' window and 2) the 'help / information window' provides a clear way to close itself. The example I discuss later demonstrates both of these characteristics. In The Beginning ... there was HTML (1st version I saw was 2.0 ??was there a 1.0??) - a markup language who's interpretation by various web browser was rather fast & loose. To further the confusion, browsers often introduced their own tags and elements independent of the html specification. Today, html is at ver. 4.01 ( http://www.w3.org/TR/REC-html40/ ), and is a sophisticated and powerful document model. Today, web browser's conformity to this model is also greatly improved and there are fewer private tags and elements. In addition to the actual html stuff, through use of a scripting language, browsers allow us to manipulate the framework that displays and interprets html. Scripting provides us with a web page object model. I mention this because recognizing this model and that a browser is an interpreter of that model has a lot to do with how to open another window. It also figures into some of Web Page Corner's future topics. The Object Model - JavaScript's perspective As with all O.O.P. stuff each of the objects has various properties,
methods, and events. |
| ------------ Web Page Code --------------- <!-- The Web Page that Opens Information Windows --> <!-- Start here to Cut & Paste the first web page --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <meta http-equiv="Content-Language" content="en-us"> <title>Open Window Samples</title> <SCRIPT> <!-- hide script from old browsers // a function to open a window where the window type and destination page are // passed by the caller // type is either 'big' or 'small' // dest contains the URL to open // mysample will contain the window object after the open call // this object could be used in other script to manipulate the window object // this sample will open one window or the other - but not both // var mysample function fnOpen(type,dest){ // first check to see if the window was closed from the information window if (mysample != null) { if (mysample.closed == true ) {mysample = null;} } // and set it to null if it was closed so it can be re-opened if (type=="big") { if (mysample == null) { mysample=window.open(dest); } // // open a window with no attributes specified = whatever the users default browser window setting currently are } if (type=="small") { // make sure the window is not already opened - keeps multiple windows from opening if (mysample == null) { mysample=window.open(dest,null, "height=200,width=400,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no"); } // // Other properties (features) include: top, left, directories, channelmode, fullscreen // Syntax: // oNewWindow = window.open( [sURL] [, sName] [, sFeatures] [, bReplace] ) } } // mysample is a window object - function fnClose(){ // make sure the window is opened before trying to close it if (mysample != null) { mysample.close(); // this lets the user reopen the window if they wish; mysample still contains data after closing it mysample = null; } } // --> </SCRIPT> </head> <body> <p>This sample page shows several examples of opening windows.</p> <p> everyone knows about <!-- the 1st uses the href tag to call the script & open a 'big' sindow --> <a href="JavaScript:fnOpen('big','sample.htm')" onMouseOver="self.status='Click Here for Definition'; return true;" onMouseOut="self.status=''; return true;"> whats-a-ma-jigs </a> yada-yada - Open a Big Window </p> <p> everyone knows about <!-- the 1st uses the href tag to call the script & open a 'small' sindow --> <a href="JavaScript:fnOpen('small','sample.htm')" onMouseOver="self.status='Click Here for Definition'; return true;" onMouseOut="self.status=''; return true;"> whats-a-ma-jigs </a> yada-yada - Open a Small Window </p> <p> We can also <a href="JavaScript:fnClose();" onMouseOver="self.status='Click Here to close the window'; return true;" onMouseOut="self.status=''; return true;"> whats-a-ma-jigs close the window </a> from the page that opened it. </p> </body> </html> <!-- End of first web page --> <!-- Start of Information Page --> <!-- Begin here to Cut and Paste --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <meta http-equiv="Content-Language" content="en-us">
|