Jeff Brown
Rafael M. Muñoz
Microsoft Corporation
February 2, 1999
The following article was originally published in the Site Builder Magazine (now known as MSDN Online Voices) "Web Men Talking" column.
Contents
Time is valuable - Using the FrontPage hover button
Who does what? - Differences between Internet Explorer versions
Where there's a will, usually DHTML is the way - Creating a select all check box
A refreshing dialog - Using HTML dialog boxes
Remember the multiple choice tests? This month, the Web Men explore how to provide an "all" option in a check-box list. They also discuss using selected parameters to refresh a dialog box, finding the hidden classes for the FrontPage hover button, and the differences between versions of Internet Explorer.
Dear Web Men:
My problem is that I am using the hover button, which works great on paper and then not in the real world. Meaning when I save and send a page to my Web site, it states fphover.class not found. As I don't have the luxury of a Microsoft server, I FTP everything to my Web site, so why then does it not work? Thank you for your time, as time is valuable.
Ed O'Keefe
The Web Men reply:
Ed, we love your last statement "time is valuable," because it sure is -- and when you run into problems such as the one you describe, which should be a simple thing, your loss of time can become very frustrating. Rest assured, we are here to be your stress relief.
The problem you are running into has to do with the special directories and files that Microsoft FrontPage maintains. Refer to the article List of Special Files and Directories Maintained by FrontPage , and you will see the reference to the _fpclass directory that contains the Java files necessary to create the hover button everyone is so excited to use. These classes are also included in the List of FrontPage WebBot Components that FrontPage maintains on a server. Since you mentioned that you don't have the luxury of a personal server that maintains these FrontPage directories and components, we'll just have to come up with another way.
We'll bet you are not the only person running into these kinds of problems; many of those special directories and components can cause the same kind of heartaches. Sometimes you can contact your Web host for possible known solutions. For example, if you searched or visited the various forums and chats on a Web host service, such as GeoCities , you would see this topic come up many times -- with other members providing helpful solutions.
In the case of the hover button, we can fix your problem with just a couple of steps. First, take a look at your existing page. The <APPLET> tag for the hover button contains the following code:
code="fphover.class" codebase="_fpclass"
The CODEBASE attribute is telling the browser to look in the _fpclass directory for the necessary Java classes that are used to create and display the hover button. Let's change this code to read as follows:
code="fphover.class" codebase="./"
Now we are telling the browser to look in the same directory as the existing Web page.
If you are following along closely, you can guess our second and final step: Copy the necessary Java class files into the same directory as your Web page. You will find the hover button Java classes in the fpclass directory under the Microsoft FrontPage directory on your machine. The two files you need to copy are the fphover.class and fphoverx.class files. When you publish your modified Web page to your Web server, place the two Java classes up there with it. Your hover button should now work like a charm. Enjoy.
Dear Web Men:
I'm an infant Web developer. I have just finished the Mastering Series: Mastering Web Site Fundamentals disk. I will take the Microsoft FrontPage certification exam this Monday. I heard from a friend of mine who took the FrontPage exam that there were a lot of questions concerning the differences between different versions of Internet Explorer. Mastering Web Site Fundamentals never touched on this information. Could you tell me the differences between the different versions. I can understand how important it is to Web developers.
Thanks for your attention,
Shelley Howes
The Web Men reply:
Unfortunately, we weren't able to get your question before you took the exam. We hope you did well, and are on your way to becoming a Microsoft Certified Professional (MCP) .
You're right, Mastering Web Site Fundamentals does not have information about the differences between versions of Internet Explorer. It focuses on hands-on work with Internet Explorer 4.0 and FrontPage 98.
Those who are interested in more advanced Web development using Visual InterDev 6.0 should check out Mastering Web Application Development with Visual InterDev 6 . That course covers a broad spectrum of topics: creating Dynamic HTML and Active Server Pages, doing database programming using Active Data Objects (ADO), and building COM components for a Web application and integrating them into Microsoft Transaction Server (MTS). Whew!
But getting back to your question -- let's give you a quick run-through of the differences between the major versions of Internet Explorer. Even though Internet Explorer 2.0 can be considered somewhat of a dinosaur at this point, you can get a summary of its features in Microsoft Knowledge Base (KB) article Q140649, Microsoft Internet Explorer 2.0 for Windows 95 Available .
Internet Explorer 3.0 was a major step forward, added a lot of new features, and a much-improved user interface, including customizable toolbars. It introduced support for "active content," meaning ActiveX controls, and Java applets, and a bunch of other useful features. You can get a good summary of its features in KB article Q152421, Description of Internet Explorer 3.01 for Windows 95 and Windows NT 4.0 .
Internet Explorer 4.0 was (and still is) a breakthrough release. In addition to its support for integration of the browser with the Windows shell (user interface), it introduced Dynamic HTML (DHTML) support, Web site subscriptions and channels, and support for a number of Web standards, including HTML 4.0 and Cascading Style Sheets (CSS), level 2.
For a description of the differences between Internet Explorer 3.0 and 4.0, see Internet Explorer 4.0: The What, Why, and How of a Very Different Browser, and Authoring Strategies for Internet Explorer 4.0 & 3.0. You should also check out What's New in Internet Explorer 4.0 for more details on that version.
In addition to providing a very rich set of features on Windows 95, Windows 98, and Windows NT 4.0, Internet Explorer 4.0 runs on other platforms, including Macintosh and UNIX. See a description of which features are supported where in Internet Explorer 4.0 Runs Cross-Platform.
Though Internet Explorer 5 is still being developed, it looks to be an even more powerful and useful version, with its enhanced DHTML support and strong support for Web standards, such as the Document Object Model (DOM) and XML, to mention a few. See What's New in Internet Explorer 5 Beta for more details.
If you just want to peruse a chart listing browser features and what browser versions, including Internet Explorer, they are supported by, take a look at the browserkit on Webmonkey .
Dear Web Men:
I'm maintaining an Intranet Web Application. I've always have found your site a very helpful reference. Currently I'm with no solution on how I can react to the user clicking on a check box (say, named "ALL"), and examine its checked property. Depending on its state, I need to be able to check or uncheck other groups of check boxes. Can this be done?
Ivee Medrano
The Web Men reply:
Ivee, where there's a will, DHTML paves the way. It has opened the door to creating such powerful effects pages that everyday we see more fantastic Web pages being published. As we are sure the DHTML Dude, Michael Wallent, would agree, "if you script it, they will come." Okay, we'll stop with the clichés.
We have written some script that that will crunch through an entire row/column of check boxes, selecting all the items if our "all" box is checked. But we couldn't stop there; our script also automatically selects the "all" check box if all the boxes in the row/column are individually checked; and if after having selected all the items, one of the individual check boxes should get unchecked, we also uncheck the "all" box.
In our first script, which is called when the onclick() event is fired, we will use the all collection of the document object. For this to work, we will also need to give all our check boxes the same ID. To keep our selectall() function as generic as possible, we pass in the ID of the individual items and the ID of the "all" option being selected. Our function does some error checking to ensure we have a valid collection, and then we use the length property to see that we have at least one item. If all is well, we loop through the entire collection setting the CHECKED attribute of all the individual check boxes.
<SCRIPT LANGUAGE="JAVASCRIPT"> function selectall(item, all) { // obtain the collection of individual items var oObjCollection = document.all.item(item); if ( oObjCollection != null ) // do we have a valid // collection? { if ( oObjCollection.length != null ) // do we have // at least one item? { // loop through collection checking all boxes for ( i = 0; i < oObjCollection.length; i++ ) { oObjCollection(i).checked = true; } } } } </SCRIPT>
As we said, we couldn't stop there; give us an inch, and we'll take a mile. In the script below, we have created what is called a named script, which looks for onclick() events from all items with the ID of "likes"; note that this capability works with Internet Explorer only. This script is not as generic as the first, and we are assuming all the individual items have IDs with the value of "likes" and the "all" check box has the ID of "likesall." But we hope you'll agree that when used in conjunction with the first script, things appear a lot slicker.
First we ensure that the "all" option cannot remain checked if an individual item is unchecked. We do this by examining the CHECKED attribute of the individual item firing the onclick event using the this keyword, which provides a reference to the current object. If an individual item is being selected, we use the all collection again to do a quick check of each individual item. If every item has been selected, we go ahead and automatically select the "all" option just to keep things clean.
<SCRIPT FOR="likes" EVENT="onclick"> if (this.checked == false) // individual item unchecked? { likesall.checked = false; // uncheck all option } else { // obtain the collection of individual items var oObjCollection = document.all.item("likes"); if ( oObjCollection != null) // do we have a valid // collection? { if ( oObjCollection.length != null ) // do we have // at least one item? { // are all individual boxes checked? for ( i = 0; i < oObjCollection.length; i++ ) { if ( oObjCollection(i).checked == false) { return; //NO, exit loop } } // YES, check all option likesall.checked = true; } } } </SCRIPT>
Now, what happens when the "all" option is unchecked? Do we allow for this? We are sure you can come up with a few options on how to handle this, but we would ask the person with the money, because we all know the employer is always right -- or was that the customer?
Try the sample.
|
Dear Web Men:
Hi,
I have a requirement for a user to be able to fill in a form by selecting an item from a pop-up dialog box.
The dialog box is an ASP page that displays a tree generated by a database. The user would click on a tree node which would return that value to the originating page. To limit the data in the tree, I need the user to first select a parameter from a drop-down box. I then would like to refresh the dialog page with a new tree (calling itself from a form).
The page works fine as a stand-alone page, but it will not refresh when opened as a dialog box.
Is there some restriction that a dialog box cannot be refreshed? Is there some way around that?
Thank you,
Ray Messinger
The Web Men reply:
As you discovered, when you display an HTML dialog box in Internet Explorer 4.0 by calling showModalDialog(), the page displayed in the dialog cannot be refreshed. There's no way around this. Internet Explorer will open up a completely new browser instance when you try to navigate off the current page in an HTML dialog.
If you really want to do things via an HTML dialog box, you may need to change your implementation quite a bit. But perhaps there is a simple way around it. Since you need the user to select a parameter before a new tree is displayed on the page, you could display a separate parameter-selection dialog box first.
Since the tree is generated dynamically on the server, the only way it can be updated is by navigating to the same ASP file again, as you pointed out. Since you can't navigate off the current page in an HTML dialog box, you have to dynamically change the content of the currently loaded page. It's starting to sound like a job for DHTML.
You could use DHTML and data binding to create and filter the tree without leaving the dialog box. Another possibility is to use remote scripting, a technology that enables a client page to make calls to functions on an ASP file without navigating off the current page. You can find out more about it on the Microsoft Scripting Site .
As a side note, HTML dialog boxes have been improved for Internet Explorer 5 (see It's Better in the Beta: Custom Context Menus, Print from Script, Great Dialogs). In addition to being able to create modal dialogs that don't have status bars and can be resized, you can also create modeless HTML dialogs. (Sorry Ray, we tried what you were doing with modeless dialog boxes, too -- and it behaved the same way.)
Jeff Brown, when not forcing family and friends to listen to Zydeco and country blues music, manages the development of the viewer and authoring tools for the Microsoft Mastering Series.
Rafael M. Muñoz is a part-time Adonis, and full-time support engineer for Microsoft Developer Support. He takes it very, very personally every time you flame Microsoft.
February 2, 1999
Q: Micah Donahue asks if the server error message in Complete Control Is Yours is still the only way to do a 128-bit sensitive redirect.
A: Yes, particularly for Internet Explorer . It is also the safest way.
Q: Sophia needs more documentation and samples for building a software update channel.
A: See Software Update Channels in Internet Explorer 4.01 and the December 1997 Microsoft Internet Developer magazine feature Cutting Edge: Application Channel Format .
Q: Godfried Borremans asks why ";" is not required on some character references, such as < for <.
A: According to the World Wide Web Consortium , it is possible to eliminate the final ";" in SGML character references in some cases.
Q: Jerry asks how to determine in script whether a variable is set to a valid object.
A: With JScript , check to see if the variable is set to null. With Visual Basic Scripting Edition , use IsNull or IsEmpty.
Q: Stewart Saathoff asks how to determine browser type.
A: See Authoring Strageties for Internet Explorer 4.0 and 3.0 under the topic of browser detection.
Q: Tom asks how to prevent a browser from caching pages.
A: See our To cache or not to cache answer.
Q: Srikanth asks if a user exits his browser during a default 20-second section, then immediately goes back in and requests the same page again, will that previous session still be active?
A: Yes, and the new request will begin a new ASP session even though the old one exists. Refer to Managing Sessions , Q176056, INFO: ADO/ASP Scalability FAQ , and Q182892, HOWTO: Use IsClientConnected to Check If Browser is Connected .
Q: David is displaying data using ASP technology, and asks if he can also automatically save the data in a text file on the user's computer.
A: No, the user has to save the file, or you have to include an ActiveX control or similar component that will save the data.