Jeff Brown
Rafael M. Muñoz
Microsoft Corporation
Updated: February 16, 1999
The following article was originally published in the Site Builder Magazine (now known as MSDN Online Voices) "Web Men Talking" column.
Contents
Barney finds new life - Internet Explorer 4.0 and 3.03 on the same machine
The missing link - Create a page of links automatically
Keeping up with today's styles - Dynamically underlining anchors
Dynamic activation - Create a dynamic Active Desktop item
You have your orders, soldier! - Updating online status reports
Dear Readers: As the north lands reach their longest darkness, and the southern countries vibrate with light, we reflect on the past year (okay, almost a year) and the fun we've had untangling your knotty technical questions. To all, from the Web Men and their cranky editors, we wish you the best of the season -- and minimal bugs.
Some strange possibilities this month. Barney? The missing link? We shudder at the prospect, but our brave answer guys forge on toward the new year -- and the new technologies it will bring.
For December, the Web Men dig into the details of Active Desktop items, mouse events, automated pages of links, and the conundrum of hosting two versions of Internet Explorer on one drive. Pick up a trowel -- or your morning coffee -- and see what you can uncover. (Hint: Be sure to try the sample.)
Dear Web Men:
I recently installed Microsoft Internet Explorer 4.0 at work. Equipment limitations are preventing us from installing 4.0 firm-wide, so I'm still developing intranet pages for Internet Explorer 3.02. My MIS department isn't thrilled about separate bootable partitions on my machine, so I've been looking for another solution to run both Internet Explorer 3.02 and Internet Explorer 4.0. I found a posting to the comp.infosystems.www.authoring.html newsgroup that said you could install both Internet Explorer 4.0 and the 16-bit version of Internet Explorer 3.03. Several people claimed that this worked, but nobody mentioned any differences between the 16-bit and 32-bit versions of Internet Explorer 3.x. Does the 16-bit version render HTML differently than the 32-bit version?
Rachel Hoormann
The Web Men reply:
Rachel, this dilemma has become a popular question with Web developers, and it needs to
be put to rest. We would like to address your found solution, but suggest that a favorite character of very small children (and we emphasize small children), Barney -- or at least his fellow dinosaurs, those dusty 386/486 machines -- might have found new life as a
test platform for Internet Explorer 3.02 .
Let's first clarify for those of you who haven't heard or are still wondering: No, you cannot
have both Internet Explorer 4.0 and Internet Explorer 3.02 on the same machine. As Rachel pointed out, you
can have two separate, bootable partitions on your machine, one for each browser. But a quick
and dirty way around this is to load on your machine the 16-bit version of Internet Explorer,
Internet Explorer 3.03
.
Before anyone gets too excited, be warned that this solution comes with many limitations. On your 32-bit machines, Internet Explorer 3.03 can be good for viewing simple HTML pages. But as your pages get more advanced, you will run into technology that is not supported. We discussed this solution with some colleagues, who found it a fast way to test Cascading Style Sheets and basic page layouts. However, we noticed that frame layouts sometimes appear a little off, so use caution.
Our research also found that the 16-bit version does support Java , but only Java version 1.0.
Some browsing
uncovered a Java version of Asteroids -- no, wait -- we found that some applets actually work pretty well. The 16-bit version also
supports some scripting, JScript/JavaScript
and Visual Basic Scripting Edition (VBScript)
-- but again, not the latest versions, which cause some problems.
As for ActiveX controls, there is no support for them. We tested various sites that contained ActiveX controls, and it was really easy to get our machine to lock up on some of them. Depending on how the page was written and what control was being used, we found we could run into a lot of problems.
As you can see, you will run into limitations using the 16-bit version of
Internet Explorer on a 32-bit operating system while also running Internet Explorer 4.0. Now don't get us wrong.
The 16-bit version is a great browser for the 16-bit operating system. But if you are going to go for the gusto,
you really want to test your pages on a 32-bit operating system with Internet Explorer 3.02 . Then the best
solution we can recommend is to dust off that old 486 or 386 machine in your closet, or your company's
recycle center, and get it back in service.
Dear Web Men:
I work for Stanford University's Graduate School of Business, where we are trying to implement a way to automatically update hyperlinks on existing Web pages. We currently have a Java applet that, whenever a faculty member puts new files in a class directory on our IIS server, puts it inside the applet. People are then able to browse files and directories much like that of Windows Explorer environment. And this is all done automatically, with very little intervention from our Web team. The problem is that it is rather flaky with Internet Explorer (sorry, but Netscape Navigator prevails in our office). I'm assuming there is a way to do this with Active Server Page (technology) and/or Visual Basic®, but we are all novices with Internet development. I realize there is no simple answer, but I am hoping you can direct me along the right path. We basically want to make the action of making new hyperlinks a drag-and-drop event for someone who knows very little about Web pages (so we don't have to spend all day updating pages).
Thanks for your help.
Thad Lyon
The Web Men reply:
Have researchers at Stanford determined that Windows DNA will unravel the mysteries of life? Probably not, huh?
We took a look at some of the pages you are working on. To give the user a graphical Windows Explorer-like view of files, and to expand and collapse folders, you need to use Dynamic HTML , an ActiveX control
, or a Java applet (as you currently use).
But if ease of maintenance is more important than a slick user interface for browsing the files, using Active Server Page (ASP) technology or directory browsing supported by Internet Information Server (IIS)
makes sense.
The simplest thing to do is enable directory browsing on the server, and add a scrollable frame that displays a page with the contents of the faculty members class directory. The server builds a page listing the files in the class directory and subdirectories.
You could also use ASP with a server component to build the list of files and subdirectories. For more information on
directory browsing with IIS and ASP, refer to our archived answer
Spilling the contents. You need a server component that allows you to get directory contents on the server. To check out some
server components that might be useful, browse the links of ASP component developers at
ActiveServerPages , ASP Hole
, 15 Seconds
, and ASP Alliance
, as well as the ASP Developer's Site
.
Were not sure how the faculty members add files to their directories on the server, but another thing to consider is having them add files through a form on a Web page, or with a wizard. Take a look at the discussion of this in our You have your orders, soldier! answer.
Dear Web Men:
Hey, wazzup? I'm doing a Web page and am wondering if there is any way to underline a link when a user passes his mouse over it?
James M. Hershbarger
The Web Men reply:
James, you definitely are staying up with today's styling Web pages. Now that Dynamic HTML has hit, together with Cascading Style Sheets (CSS), everyone is looking for ways to incorporate both into their pages.
First, check out our last column, <TARGET="Gobble_Gobble">. In The Web Men in Short section, we told Boerries Wendling how to remove the underline style from links. To refresh your memory, it is through CSS. In the HEAD section of your page, set up the following style:
<style> A {text-decoration: none} </style>
Next, create two JavaScript functions, one each for the document object's OnMouseOver and OnMouseOut events. Once you've added that script in the HEAD section, the fuctions would look something like the following:
<script language="JavaScript"> document.onmouseover = doDocumentOnMouseOver; document.onmouseout = doDocumentOnMouseOut; function doDocumentOnMouseOver() { var eSrc = window.event.srcElement ; if (eSrc.tagName == "A") eSrc.style.textDecorationUnderline=1; } function doDocumentOnMouseOut() { var eSrc = window.event.srcElement ; if (eSrc.tagName == "A") eSrc.style.textDecorationUnderline=0; } </script>
In each function, we are obtaining the element for which the mouse event occurs -- in our case, the anchor element, or <A> tag. We then set the style object's property, textDecorationUnderline, to 1 to underline the anchor and 0 to remove the underline. This is done accordingly for the OnMouseOver and OnMouseOut events.
There you have it: a Web page containing anchors that appear without underlines until the mouse moves over them; the user is alerted by dynamic underlining until the mouse moves away. Too easy, you say? Naw, the easy part is copying and pasting the style and script sections above to your current Web page to make the magic happen. Enjoy.
Dear Web Men:
I have a desktop component that I would like to grab a value or values from another page that the user completes with a form. Basically, customization of the desktop component is the goal here. Is there any kind of scripting available for XML in the CDF file? Maybe ASP style?
John McMillion
The Web Men reply:
John, if it's a dynamic Active Desktop item you want, then that's exactly what we are here to provide. The answer to your question is, yes, you can use ASP to create a dynamic Active Desktop item. You can also use ASP technology to create dynamic Active Channel content for your users.
As with all great answers, the best way to see how this works is through a great example. First, we will talk about the form page, where users can pick what they would like to see on their Active Desktop items. Then, we'll move on to the ASP file, where the Channel Definition Format (CDF) file is created dynamically.
In our example, we have only provided two options for our user:
<FORM METHOD="POST" ACTION="dynamic_channel.asp"> Web Men Topic 1 <input Type="radio" Name="Topics" Value="1"><BR> Web Men Topic 2 <input Type="radio" Name="Topics" Value="2"><BR> <input Type=SUBMIT Value="Subscribe" Name="Validate"><BR> </FORM>
As you can see, we have used radio buttons for our options, so that only one can be selected at any time. We could have used check boxes and unique names for each option so that a user could select more than one option in a category, but simple is good for our first example. Just remember that the more options you allow, the more parameters in the ASP file you will have to receive.
Now that we have gathered the information from our user, we're ready to create the dynamic CDF file. The key to this process is in the ASP Response object and its ContentType property value. We want to set this value to "application/x-cdf" and insert this line before any CDF lines to ensure that the server returns the correct MIME/content type.
You will probably want to view the ASP file in a separate window while you read along. You will also want to be familiar with the ASP and CDF elements.
As you can see in the code, we get our input parameters first, then we set the MIME/content type:
<%Response.ContentType="application/x-cdf"%>We then proceed to create our CHANNEL referencing our ASP file, in the HREF, and the incoming parameter, Topics. Next, we test the parameter and set the ITEM tag to the appropriate HREF.
Note: Here in the If-Then-Else block, we can define any unique element that we wish -- for instance, an update schedule. For a dynamic channel, we can also define unique logos for each item.
Because we are creating an Active Desktop item, we finish our CDF file with the USAGE tag identifying how the ITEM element should be used: DesktopComponent. Again, we would like to point out that all the details of creating a CDF file can be found in the Content & Component Delivery area and the Internet Explorer 4.0 overview.
View Dynamic Active Desktop item sample.
Dear Web Men:
Let's say you had an online status report of something and you wanted your users to be able to update it via an online form you created for them. Is it possible to use JavaScript to create a file on the server with text that would make an HTML file, so the changes would be persistent? I really don't have a strong desire to use CGI. Thanks for your help!
Corporal Kevin Brown
United States Marines
The Web Men reply:
The short answer is negative, sir (for our non-military friends, that's "no"). You cannot use client-side JavaScript to create or update files on the server. In order to do such things on the server, you need to do some server-side processing, and use something like ASP technology or CGI.
You could definitely use ASP technology with server-side JavaScript to process the form, and then use the ASP File Access component to create and update HTML files on the server. But the best solution would be to have a database on the server that the ASP script or other server-side script could use to store and retrieve data for the status reports.
Another possibility, if you just want to allow people to upload their completed status reports through a form on a Web page, is to use form-based file upload. Internet Explorer 4.0 supports this, and version 3.02 supports it with the HTTP File Upload Add-on
. If your browser supports this, you can use an INPUT control on a form and use the TYPE="FILE" attribute. The server must be able to process forms that submit data using this method, too. Internet Information Server (IIS)
supports this with the Microsoft Posting Acceptor
. Also, check out the Microsoft Web Publishing Wizard
, which is another way you can let users easily upload files to a Web server.
Jeff Brown, when not forcing family and friends to listen to Zydeco and country blues music, helps develop training courses in the Microsoft Mastering Series -- with a smile.
Rafael M. Munoz is a part-time Adonis, and full-time support engineer for Microsoft Technical Support. He takes it very, very personally every time you flame Microsoft.
Added December 15, 1997
Q: Michael Josem wants to sort tables using Data Binding and DHTML.
A: Use the
SortColumn property of the
RDS.DataControl .
See
our answer
Name that tune
and the DHTML Dude column
Getting Your Page's Data Into a Bind.
Q: Dhwanit Shah wants to learn about Microsoft Agent.
A: See the
Microsoft Agent site,
and the new book
Developing for Microsoft Agent .
Q: Greg Winterhalter asks how to use the File Upload Control.
A: See the Web Publishing Wizard SDK , and our answer You have your orders, soldier!
Q: Eric Outley wonders if he can use Microsoft® Excel spreadsheet objects from ASP scripts.
A: Create them with Server.CreateObject and use their methods and properties as any other ActiveX Server Component.
Posted December 1, 1997
Q: Andres Ballen wants a script to load a Web page in Internet Explorer 4.0, full-screen mode.
A: See the Window
object's
Open
method. Some users do not know how to get out of full-screen mode; use it with the
channelmode feature to provide
Minimize and Close buttons.
Q: David Russell seeks the simplest way to put a page counter on his intranet pages.
A: Use the Hit Counter component in Microsoft FrontPage 98 . See our archived answer You can count on me, and the Microsoft Office 60 Minute Intranet Kit
.
Q: David Katz wants to use ASP technology to develop forms that interact with a database on a Web server. How can he use ActiveX controls to manipulate the data?
A: Use Remote Data Service (RDS) technology (formerly called ADC) with data-aware ActiveX controls on the forms. See our archived answer Feed me, and the RDS Web site .