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

To '99 and Beyond

Jeff Brown
Rafael M. Muñoz
Microsoft Corporation

January 4, 1999

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

Contents
A cornucopia of controls - Dynamically displaying ActiveX controls
Decisions, decisions - Changing a service provider account
Screen shot - Obtaining client screen parameters
Adding some style - Displaying XML

This infant year finds the Web Men already hard at work grinding out answers both short and long. They're talking about dynamic display of ActiveX controls, and how to get stuff, such as a client's screen height and width. They also address XML and give a few tips about how to get the most technology for the price from your ISP.

Do you have a puzzler? Remember to check the Web Men's greatest hits -- and if the answer isn't there, send your in your question.

A cornucopia of controls

Dear Web Men:

I have a need to launch different ActiveX components from within a page, based on which item a user chooses from a drop down list (which itself is a field on an ASP file, loaded from a server- side database). I can handle the list creation, no problem, and I can retrieve and display a hidden argument based on the choice, but how do I get different OCXs to launch based on the argument? I can pop up an alert in a JavaScript showing the name of the OCX, so I know I have identified the correct one, but loading it eludes me.

Help...

Many thanks. 

Neil Harman

The Web Men reply:

Creating a cornucopia of controls -- and just in time for the holidays. How appropriate. Through the use of Dynamic HTML, we are going to spread some holiday spirit. We need just one magical property: innerHTML.

Neil, we are going to leave the database access and creation to you, so our sample is going to be just an HTML page instead of an Active Server Pages (ASP), but we are sure you'll be able to make the transition. Let's first create a drop-down list box with the <SELECT> element and give it the NAME "selectctrl." For the purpose of our sample and space, we are going to use only two controls: the Calendar and the Slider controls; in your case, you have a database full. We set a VALUE for each OPTION, so that we can check the values later in our script. Our drop-down list box looks like this:

<form>
<SELECT id=select1 name=selectctrl style="HEIGHT: 22px; 
  WIDTH: 224px" onchange = "changectrl(this.form);">
  <OPTION selected>Select control...
  <OPTION>Calendar
  <OPTION>Slider
  </SELECT></P>
</FORM>
<P>
<div id=axctrl>
Select control... 
</div>

Notice we have created a space, <DIV id=axctrl>, within which to display the ActiveX controls. We will refer to this area later in our script.

Our script, in the <HEAD>, contains our function changctrl(), which accepts a reference to the form when the onchange event occurs in our list box. Using the form reference and the name of our list box, selectctrl, we use the selectedIndex property to retrieve the selected option that will be used within our switch statement to determine the control to display. Once we have identified the control to display, we use the innerHTML property to set the contents of the <DIV> area to the new HTML text, which contains the <OBJECT> tag and <PARAM> properties necessary to display the new ActiveX control.

<script language="JavaScript">

function changectrl(theform)
{
 /* check which item was selected in the Dropdown
    list box, selectctrl, of the form
 */
 selected = theform.selectctrl.selectedIndex
 switch (selected)
 {
  case 1:  // calendar control
    var ctrl = 
     "<OBJECT 
       classid=clsid:8E27C92B-1264-101C-8A2F-040224009C02 
       id=Calendar1>"
    +"<PARAM NAME='_Version' VALUE='524288'>"
    +"<PARAM NAME='_ExtentX' VALUE='7620'>"
    +"<PARAM NAME='_ExtentY' VALUE='5080'>"
    +"<PARAM NAME='_StockProps' VALUE='1'>"
    +"<PARAM NAME='BackColor' VALUE='-2147483633'>"
    +"<PARAM NAME='Year' VALUE='1998'>"
    +"<PARAM NAME='Month' VALUE='12'>"
    +"<PARAM NAME='Day' VALUE='16'>"
    +"<PARAM NAME='DayLength' VALUE='1'>"
    +"<PARAM NAME='MonthLength' VALUE='2'>"
    +"<PARAM NAME='DayFontColor' VALUE='0'>"
    +"<PARAM NAME='FirstDay' VALUE='1'>"
    +"<PARAM NAME='GridCellEffect' VALUE='1'>" 
    +"<PARAM NAME='GridFontColor' VALUE='10485760'>"
    +"<PARAM NAME='GridLinesColor' VALUE='-2147483632'>"
    +"<PARAM NAME='ShowDateSelectors' VALUE='-1'>"
    +"<PARAM NAME='ShowDays' VALUE='-1'>"
    +"<PARAM NAME='ShowHorizontalGrid' VALUE='-1'>"
    +"<PARAM NAME='ShowTitle' VALUE='-1'>"
    +"<PARAM NAME='ShowVerticalGrid' VALUE='-1'>"
    +"<PARAM NAME='TitleFontColor' VALUE='10485760'>"
    +"<PARAM NAME='ValueIsNull' VALUE='0'>"
    +"</OBJECT>";
    break;

  case 2:  // slider control
    var ctrl = 
     "<OBJECT 
       classid=clsid:373FF7F0-EB8B-11CD-8820-08002B2F4F5A 
       id=Slider1>"
    +"<PARAM NAME='_ExtentX' VALUE='2646'>"
    +"<PARAM NAME='_ExtentY' VALUE='900'>"
    +"<PARAM NAME='_Version' VALUE='327682'>"
    +"<PARAM NAME='BorderStyle' VALUE='0'>"
    +"<PARAM NAME='MousePointer' VALUE='0'>"
    +"<PARAM NAME='Enabled' VALUE='1'>"
    +"<PARAM NAME='OLEDropMode' VALUE='0'>"
    +"<PARAM NAME='Orientation' VALUE='0'>"
    +"<PARAM NAME='LargeChange' VALUE='5'>"
    +"<PARAM NAME='SmallChange' VALUE='1'>"
    +"<PARAM NAME='Min' VALUE='0'>"
    +"<PARAM NAME='Max' VALUE='10'>"
    +"<PARAM NAME='SelectRange' VALUE='0'>"
    +"<PARAM NAME='SelStart' VALUE='0'>"
    +"<PARAM NAME='SelLength' VALUE='0'>"
    +"<PARAM NAME='TickStyle' VALUE='0'>"
    +"<PARAM NAME='TickFrequency' VALUE='1'>"
    +"<PARAM NAME='Value' VALUE='0'></OBJECT>";
    break;
    
  default: // for "Select control..." option
    axctrl.innerText = "Select control..."
    return;
 }

 /* set the innerHTML property of the DIV area,
    axctrl, to our new ctrl string
 */
 axctrl.innerHTML = ctrl;
}
</script>

There you have it -- all the ingredients to spread some holiday joy.

TopBack to top

Decisions, decisions

Dear Web Men:

My service provider has a UNIX server that I connect to. My main goal is to use Visual Basic and other Microsoft technologies to do my Web programming on a personal account that I have with them. They said they have a Windows NT Server running IIS 3.0 that they could switch me to. They charge US$25 to switch and said I would need to use FrontPage to send files to the server. I have FrontPage Express. They also said that for an extra US$15 a month, I could FTP to their site. I'm not sure if this is what I want or need.

Actually I would like to be able to build things like chat and other interactive things using Visual Basic, DHTML, Visual Basic Scripting Edition (VBScript), etc. I have tried the CGI scripts out there on my present UNIX connection and don't like them. I guess what I'm really after is to be able to write a server-side program that could do the interactive things. Will I need FTP to send such programs, and is it even possible to do such things. Or maybe I'm better off with the UNIX connection I have. I was hoping to just try it out to see, but at the extra cost I would like to be sure it is what I need. Also, I'm using Windows 98 with Internet Explorer 5.0. If you could shed any light on this, I would greatly appreciate it

Thank you

Bill Hudson

The Web Men reply:

There many ways to go, but we'll see if we can provide some enlightening information. First, it's not clear from your question whether the $15 fee for FTP service applies just to hosting your site on their Windows NT Server. We would guess that you would have to pay this fee if you decided to host your site on their UNIX server, too. To put any of your own files on your service provider's server -- whether it be a UNIX server, Windows NT Server, or whatever -- you will need to use FTP or a similar file-transfer mechanism.

If you use the full version of FrontPage Non-MSDN Online link (not FrontPage Express), you can also transfer files via FrontPage Server Extensions (as your service provider told you). FrontPage Server Extensions are fully supported on IIS/Windows NT Server. They are also supported for other platforms Non-MSDN Online link, including UNIX. See the Microsoft FrontPage 98 section of the Web Workshop for articles about FrontPage and FrontPage Server Extensions.

If there is not an additional charge for accessing the ISP's Windows NT Server via FrontPage, then there is no need to pay for FTP service. But you would need to buy the full version of FrontPage.

If you want to do server-side programming, using ASP technology is definitely the way to go. ASP files are much easier to create than doing CGI programming. But remember that you can also do cool things through client-side scripting, and by using DHTML on the client. In the case of client-side programming, it doesn't matter what type of server the HTML pages reside on. Another thing to keep in mind is that you can use Visual Basic to build ActiveX components for both the client and server.

Since we work at Microsoft, we're biased toward Microsoft products and technologies, which should come as no surprise. By using the combination of FrontPage, VBScript, DHTML, and ASP, you can build very powerful Web sites very efficiently. So we recommend that if you plan to do a significant amount of Web development, and need to do server-side programming, you should have your service provider transfer your account to their Windows NT Server, and you should upgrade to FrontPage. You could also encourage them to upgrade their Windows NT Server to IIS 4.0Non-MSDN Online link.

But you need to decide if the amount of programming you are going to do justifies upgrading to the full version of FrontPage. If there is no additional charge for using FrontPage to access your service provider's server, as opposed to US$15/month for FTP service, then you would be getting a great development tool that would pay for itself over time. Another thing you might consider in the short term is checking out the Office 2000 Consumer Preview Program Non-MSDN Online link. That way you could try out beta versions of all the new Office 2000 products, including FrontPage 2000, for a pittance. Good luck.

TopBack to top

Screen shot

Dear Web Men:

Although the standard we use in house is 800x600, we need to make our pages legible in 640x480 screen definition. I'd like to be able to impress different styles on my ASP pages based on the display selected by a visitor, and enhance their viewing experience.

Do you guys have any suggestions? 

Denis Vermeirre

The Web Men reply:

Denis, we are going to keep this answer short and sweet. This topic has worried many a reader, and DHTML has everything you need. With the NBA on strike, we saw a chance for a slam-dunk, shake and bake, screen shot.

The object you are interested in is the screen object; it provides all the information you'll need on the client's screen and rendering abilities. Checking a few of the properties when the page is loading will allow you to set styles and change page setup to make every user's experience a pleasant one.

Here is a quick sample for everyone to begin playing with:

<HTML>
<HEAD>
<META NAME="GENERATOR" 
  Content="Microsoft Visual Studio 6.0">
<TITLE>Web Men - Screen shot</TITLE>
</HEAD>
<BODY>
<script for=window event=onload>
  var str = "Here are the client's screen 
    and rending capabilities"
  +"<br>"+"availHeight = "+screen.availHeight
  +"<br>"+"availWidth = "+screen.availWidth
  +"<br>"+"bufferDepth = "+screen.bufferDepth
  +"<br>"+"colorDepth = "+screen.colorDepth
  +"<br>"+"fontSmoothingEnabled = 
    "+screen.fontSmoothingEnabled
  +"<br>"+"height = "+screen.height
  +"<br>"+"width = "+screen.width
  +"<br>"+"updateInterval = "+screen.updateInterval;

  screenshot.innerHTML = str;
</script>

<div id=screenshot>
</div>
</BODY>
</HTML>

TopBack to top

Adding some style

Dear Web Men:

Maybe I'm mistaken, but I was under the impression that XML and XSL would combine together to replace HTML. If so, where's the tutorial for making static Web pages? For example, if I have a XML file, based on a DTD, how do I write and link the XSL to make it look pretty in Internet Explorer 5, or even convert it to HTML? TIA.

Jared Warren

The Web Men reply:

Nope, you're not mistaken Jared. An Extensible Markup Language (XML) document and Extensible Style Sheet Language (XSL) style sheet can be combined together to create quite a lovely HTML document that can be displayed in Internet Explorer 5. You can also associate Cascading Style Sheets (CSS) information with an XML document.

There are several other ways you can display XML in Internet Explorer 5, using an XSL style sheet, or otherwise. These are described in the Extreme XML column, Internet Explorer 5 and XML, and in the XML Support in IE 5 section of the XML section of the Web Workshop.

TopBack to top

 


This Month's Hot-Button Issue

How to Use a Remote DLL from ASP

We asked Yuri Lausberg to write us a little article for this month's Hot-Button Issue, but as his creative juices began to flow -- and the next thing we knew, he had created a masterpiece that could stand alone. Check out out his new article, which has the great privilege to reside in the Site Builder Network Workshop under Server Technologies. Managing In-Process COM Components Using MTS and ASP Technology describes a resolution on how to use DLLs through DCOM using MTS. Have fun.

Back to topBack to top

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.


The Web Men in Short

January 4, 1999

Q: Jacky Wilson wants custom HTTP errors using Internet Information Server (IIS) 3.0.

A: This is not available on IIS 3.0. Install Windows NT Server 4.0 Option PackNon-MSDN Online link to upgrade to IIS 4.0Non-MSDN Online link, which provides this capability.

Q: Matt Donovan wants to find answers to HTML Help questions.

A: See the HTML Help section of the Web Workshop.

Q: Nick wants to display the little "popup label" when the mouse passes over an icon, button, or link.

A: This is known as a ToolTip; refer to the Title property and the DHTML Dude's article The Time has Come to Talk of Many Things.

Q: David James wants to build an e-commerce site.

A: See the commerce Online Special Interest Group (OSIG), and the commerce topics in the Web Workshop Server Technologies area.

Q: Many folks are interested in the MSDN Online navigation bar.

A: Specifics can be found in A Tour of the Code &ndash; NavBar: Dynamic Menu Generation and A Tour of the Code &ndash; NavFrame: Selective Frame Activation. For the complete story see A Tale of Two Web Teams: Touring the Redesign Code.

Q: Marie-odile Marché wants documentation on using VBScript and JavaScript in Internet Explorer.

A: See the VBScript and JScript tutorials on the Microsoft Scripting TechnologiesNon-MSDN Online link site and the Web Workshop's DHTML, HTML & CSS area.

Q: Anonymous asks how to use the Microsoft Agent.

A: Download the samples and refer to documentation in the Microsoft Agent section of the Web Workshop.

The Web Men's Greatest Hits

List of Web Men Topics



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.