Click to return to the Essentials home page    
Web Workshop  |  Essentials

All Answers, All the Time


Jeff Brown
Rafael M. Muņoz
Microsoft Corporation

March 2, 1998

The following article was originally published in the Site Builder Magazine (now known as MSDN Online Voices) "Web Men Talking" column.

Contents
Better than slides sample - Viewing larger thumbnail of graphics on a page
DHTML for simple folk - Swapping button images
Finding the fine print - Receiving e-mail with Channel updates
Making a <B>statement</B> - Formatting form input
"Dyn-o-matic!" - Using ASP to view files on a server

Amid much anniversary celebration, the Web Men find their wacky answer column one year old. That's one full year of answers to your questions -- all neatly archived for your convenience. Check out their List of Topics.

Have a stumper that hasn't been addressed? Send it in. Jeff and Rafael look forward to another year of questions and conundrums to solve. If the Web Men were a radio station, we'd call their format Alll-Answer Radio. Think of them as your 7 x 24 answer source.

Better than slides

Dear Web Men:

I am setting up an Internet server to share photographs with other publications. Each pub will have FTP access to the server to post photos. Accessing the photos is the problem. With an FTP directory, you would only see the name of the file for downloading. Our members would like a preview image before downloading. Can you set up an Active Server Pages file to display a low-res preview file with a hyperlink to download the high-res file? Caption info would be a big plus, too.

Thanks,

Jim Dunda

The Web Men reply:

Remember everyone sitting around eating popcorn, watching Jim's trip to Alaska, and listening to the slide carousel move as the next slide came up? What Jim describes in his question is going to become the new wave for viewing pictures.

Jim, you can do this in many ways. You can use framesets and update a preview frame with a new image when one is selected from your main viewing frame. Using Active Server Pages (ASP) technology, you can pass parameters to the preview frame and dynamically set things, such as captions. A great place to start gathering information on ASP technology is Nancy Winnick Cluts's article An ASP You Can Grasp: The ABCs of Active Server Pages.

We wrote you a quick and dirty example that uses tables, Dynamic HTML (DHTML), and JavaScript Non-MSDN Online link. Of course, we used our best pictures!

 sample View thumbnail sample.

To display caption information, you can again use DHTML and a little JavaScript. Check out the Visibility Versus Display sample in the Dynamic HTML section of the MSDN Online Tools & Samples area for a sample of how to display and hide text. Just view the source of the sample frame to see how things are being done.

A site that does a fantastic job at using clips and showing a preview is the Microsoft Clip Gallery Live Non-MSDN Online link site. They are using framesets and passing parameters to a preview page using ASP technology. The parameters define both the picture and keywords that are to be displayed in the side bar. They are a little fancier than our sample, but then samples are suppose to spark your creativity to create sites like the Clip Gallery Live.

Back to topBack to top

DHTML for simple folk

Dear Web Men:

Sorry about the e-mail, but there is just no one else in (the MSDN Online) site to ask. I could Ask Jane, but then Jane says that she doesn't want any individual questions. Talk about a contradiction. Anyway, my question is simply about DHTML. I love the fact that things are getting easier for the common person to create dynamic pages, but what can we do about the delay in an image swap when we hover over a button. I am using a 4K button, one at rest and one on mouseover. But the delay in the dynamic button really kills the whole idea. I would welcome any suggestions.

Anonymous

The Web Men reply:

We want your e-mail, and don't fret about Jane. She's just been a little distracted lately, toting up sales of Ask Jane items at the MSDN Online Store.

A 4K button seems a bit large. If you really are intent on using separate images to get the effect of a dynamic button, the first thing to do is to use much smaller images. You should also ask yourself some questions.

Could you come close to the effect you want for the dynamic button by changing color or text on that area of the page? In other words, do you really need a rich graphic for the button? Also, regardless of whether the button is text or an image, why not just change its appearance by applying a filter, rather than using separate images? Filters can change the appearance of an image or text very efficiently, and would work great in this situation. For all the details on using filters, check out the Filters and Transitions section of the Web Workshop.

Back to topBack to top

Finding the fine print

Dear Web Men:

I have subscribed to my favorite channels and requested that I receive e-mail when changes have occurred. I haven't received e-mail from any of those channels -- and yet, when I head out to one of those sites, they have definitely changed. What am I doing wrong?

Sophia Strand

The Web Men reply:

Sophia, this is an excellent question -- and one that we believe might be causing a whole lot of confusion, something like reading fine print found on legal documents. In this case, it would be considered finding the fine print.

To clear things up: "You will receive a gleam and e-mail only if there are changes to the Channel Definition Format (CDF) file, which describes the contents of the channel." Should there be a change only in the contents of other channel pages (.htm, .asp), you will not receive e-mail. It is completely up to the publisher to ensure that you will receive e-mail by changing the CDF file at the same time that changes are made to the content.

Now, before you rush out to mob the publisher of your favorite channel, check things at your end to ensure that you have everything set up correctly. You can do this by checking the settings in the Channel Properties dialog box. From Internet Explorer 4.0 Non-MSDN Online link, choose Favorites from the menu bar and select Manage Subscriptions... to bring up the Subscriptions window. Right-click on the subscription of interest and choose Properties to bring up the Channel Properties dialog box. Be sure that you have checked the option "Send an e-mail message to the following address" in the Notification section of the Receiving tab. Also, click Change Address..., and ensure that you have entered the correct e-mail server name.

You can also make this selection when first subscribing to a channel from the Add Active Channel ™ content dialog box. Just hit the Customize button to bring up the Subscription Wizard. The second step will allow you to select an option to have e-mail sent to you.

Two articles written by George Young of the MSDN Online Web Team provide some great information on channels and this subject: CDF 101: Creating a Simple Channel with Active Channel Technology and CDF 201: Beyond the Basics in Channel Creation. And even as we speak, our buddies in support are working on an article to describe the details of channels and the e-mail process. Be sure to check the Microsoft Support  Non-MSDN Online link site for upcoming information.

Once you are sure that the publishers of your favorite channels have checked the references above, and you have everything set correctly but are still not receiving e-mail, then maybe you can mob them.

Back to topBack to top

Making a <B>Statement</B>

Dear Web Men:

Hi Guys.

I always enjoy your column and get heaps from it, but now it's time for a question of my own. I'm creating a database-driven site where users will be able to post their own content. The problem is that it's pretty hard to include formatting if I store an article in the database, which gets its input from a fill-in form. For instance, if a user wants a line of bold text half way through the text. That's gonna' be hard to figure unless I use some sort of marker (which I'd rather not do). I had a look through an old MSDN Online site design article and kind of got the feeling you may format your text dynamically. If so, how do you do it? Can it be done?

Cheers 'n' beers,

Graeme Merrall
MSDN Online Level 2 member, New Zealand

The Web Men reply:

We're guessing that either your users are not HTML savvy, or you want to limit what sort of formatting they can do in their content, or both. Because it would be easiest to let them upload their HTML content (formatted to their heart's content -- no pun) to your site directly. We talked about this in our You have your orders, soldier! answer.

If you want to limit a user's content to what he or she can type in a text area on a form, you can allow a limited number of formatting options. But you need to include some specials character for markers, as you said. Then in client-side or server-side script, search the original text for the markers, and insert the appropriate HTML tags to do the formatting.

Another option along these lines is to include additional form fields in which a user can enter the words from the text area to which a formatting option applies. For example, say that in the text area the user had entered "This is the content that I need stored." Then he entered the words "This" and "I" in another text area for words that need to be bold. Your script would search for "This" and "I" in the text the user submitted through the form, and insert <b></b> tags around them before storing the text in the database.

Both of these methods are a little clunky. A cooler way to do it is to use Dynamic HTML on the client. The Internet Explorer 4.0 Non-MSDN Online link implementation of DHTML gives you enough power to build a WYSIWIG (What You See Is What You Get) word processor in a single Web page.

Using client-side scripting and DHTML, you can allow users to format their text, and see the formatting changes, before sending it to the server. If you include some buttons on the page for applying formatting to text, you can then write script that will modify the text the users selected and insert the appropriate formatting tags around it after they click one of the buttons. That way, the HTML text changes on the client before it is submitted to the server.

One way to achieve this magic is to have your script call the createRange method of the document.selection object. This creates a nge object representing the current text selection the user made. Then you can call the execCommand method of TextRange to change the format of the selection. You can use the Bold, Italic, or FontName commands as well as others. For more ideas, check out Using the TextRange Object.

P.S. If you run into Xena filming on location in your homeland, can you please give her our best? Thanks.

Back to topBack to top

"Dynomatic"

Dear Web Men:

Is there a function or property that will return the creation date of a file on the server? I've been looking for an answer for about a week now. We have a site set up where our members can download an information file that is updated daily. However, they are quite particular about knowing exactly when the file has last been updated. What I've been doing up till now is manually adjusting the date and time in my asp, but I'm sure there's a function out there that will read the date and time automatically.

Can you help me?

Burt

The Web Men reply:

Manually, Burt! We believe today, Jimmy "JJ" Walker would probably be using the term "Dyn-o-matic!" You'll be happy to know that we happen to know of a few tricks that will bring the luxury of dynamically created information to your life.

First let us say that you are on the right track. You are using Active Server Pages, perfect. What you want to do is look into the one of the many Installable Components  Non-MSDN Online link available with ASP. We have mentioned a couple of them in other columns: Ad Rotator and Browser Capabilities. The one you will be interested in, Burt, is the File Access Component  Non-MSDN Online link, which allows you access to the computer's file system.

We have provided you with some starter code that should give you a good jump on your solution. This code will dynamically create a list that contains the name of each file and the date each file was last modified given a specific directory. For our example we created a public directory on our server "d:\inetpub\wwwroot\public" which we used for testing purposes. You, of course, will want to change this string constant to reflect the location of your files.

<%
response.write "<h1>File Listings</h1>"
response.write "<p>"

Dim objFSObject, objFolder, colFiles, intF1, 
  strFName, strDate
Const strDir = "d:\\inetpub\\wwwroot\\public"
Set objFSObject = CreateObject
  ("Scripting.FileSystemObject")
Set objFolder = objFSObject.GetFolder(strDir)
Set colFiles = objFolder.Files

For Each intF1 in colFiles
    strFName = intF1.name
    strDate = intF1.DateLastModified
    response.write strFName & " " & strDate &"<br>"
Next
%>

We used the CreateObject  Non-MSDN Online link function to obtain a FileSystemObject object, which provides us access to our server's file system through various methods. Using the GetFolder method, we can get a Folder  Non-MSDN Online link object that provides us access to the Files  Non-MSDN Online link collection containing all the File  Non-MSDN Online link objects in that folder. Now that we have this information we loop through our Files  Non-MSDN Online link collection using the Name  Non-MSDN Online link and DateLastModified  Non-MSDN Online link properties to create our dynamic list for our page.

Jeff Brown, when not forcing family and friends to listen to Zydeco and country blues music, helps develop Microsoft Mastering Series titles -- 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.


The Web Men in Short

Posted March 2, 1998

Q: Arjumand Bonhomme has trouble viewing ASP files on Microsoft Personal Web Server.

A: To view ASP files on any server, the files must reside in an executable folder. See the Microsoft Knowledge Base article FP98: ASP Code Displayed in Browser  Non-MSDN Online link.

Q: A reader asks if he should use VBScript for server-side scripting only, and use JavaScript for client-side scripting.

A: If you need to target multiple browsers, this is a good general rule.

Q: David McCabe wants use the full features of IIS 4.0 for small-scale Web development.

A: If you use Personal Web Server Non-MSDN Online link, it will not support high-volume Web sites and does not include such features as Microsoft Site Server Express Non-MSDN Online link, and Certificate Server Non-MSDN Online link.

Q: Jon Parkinson asks why there is no link to Microsoft's VRML page from the MSDN Online Web site.

A: There is. From the Products menu of the MSDN Online site-wide navigation menu, point to Browsing and Viewing, then click VRML support Non-MSDN Online link. We will ask that a link be added to the Technologies menu, too.

Q: When using the hover button in FrontPage 98, Leif Nesheim sees a gray box where the button should be.

A: See these Microsoft Knowledge Base articles: FP98: Hover Buttons and Banner Ads Show Class Not Found Non-MSDN Online link, FP98: Hover Button and Banner Ad Manager Preview as a Gray Box Non-MSDN Online link.

Q: Craig May wants to create a VBScript variable that can be shared by both client and server objects.

A: You have to maintain separate variables on both the client and server. Use cookies to set and read the shared value.

Q: John Clark wants to see GIF or JPG images in his e-mail, instead of adding them as attachments.

A: You need the capability to read HTML mail from your mail reader, currently available in Netscape Communicator 4.x, Eudora Pro 4.0, and Outlook Express Non-MSDN Online link and Microsoft Outlook 98 Beta 2 Non-MSDN Online link.

Q: Jimi Joergensen asks how to use cookies on a Web site without using ASP.

A: ASP makes this a lot easier when IIS Non-MSDN Online link is the Web server, but you can also use cookies in client-side script, with CGI scripts on the server. Check out our Bake a batch answer.

The Web Men's Greatest Hits

List of Web Men Topics

Write us!



Back to topBack to top

Did you find this article useful? Gripes? Compliments? Suggestions for other articles? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.