This article may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. To maintain the flow of the article, we've left these URLs in the text, but disabled the links.


MIND


GEEK

Robert Hess

GEEK Is it possible to use an applet as a body background? I want to use an applet that creates moving snow (located at http://www.isbiel.ch/~troxp/java/apl/Snow/e.html) and place still images in the foreground.
GEEK What you want to do is technically feasible, but there are serious complexities involved, so this is not yet directly supported by the available browsers.
      For instance, it's possible to use Dynamic HTML (DHTML) in Microsoft® Internet Explorer 4.0 to create an animated object within a <div> that lays beneath the text on a page. Thus, conceptually, the falling snow should happen on the background of the page. But if you run the page, you will notice that the snow appears to fall above any text on the page. Why? The answer involves issues of display surfaces, clipping regions, rendering, and most important, performance.
      While visually the Java applet and DHTML are drawing to the same display surface, technically they are not. Each is actually drawing to its own in-memory display surface, and then those two surfaces are combined on the screen. For the text to stay above the animating background, DHTML would have to create a complex clipping region that the system would use as a mask for combining the two regions. And since this region would consist of text rather than just a couple of squares or rectangles, it would be a very complex clipping region. Reconciling these two display surfaces together would be a fairly computer-intensive process and the results would not be pretty.
      It gets even more complex if the snowing <div> is sandwiched between two DHTML text blocks so one block of text should be on top of the snow and the other underneath.
      A shortcut might be to have the Java applet render its surface and pass it to the DHTML engine, which would render its text surfaces and then perform a transparent BitBlt (a technical term meaning an image transfer with transparency). The BitBlt process provides an in-memory bitmap image that represents the properly layered result, and this image is then transferred to the screen. This is still a fairly involved process, and again the results are unacceptable.
      For an idea of what this might look like, build a page that has a "watermark" background image
 <body background="snow.gif" bgproperties="fixed">
with some text on the page, then scroll the page up and down. Here, Internet Explorer 3.0 is essentially using the transparent BitBlt process for combining the two surfaces. Notice the ugly flashing? This is probably what would happen constantly with an animated falling snow background.
      Now take a look at this same page in Internet Explorer 4.0. The ugly flashing is gone. This is because in Internet Explorer 4.0, DHTML fully owns both the background image and the rendered text. It is able to more efficiently combine the different layers and make sure they display in a more optimal fashion.
      Note that I am not saying this functionality won't ever be supported by browsers, just that there are enough complexities involved that it will take careful planning and design to implement properly. Also, a feature such as this is not considered a high priority. That doesn't mean that what you are trying to do isn't possible, only that you need to take a different approach.
      If you really want an animated background—which I highly recommend against—you need to design it so that it is dealt with fully within the context of DHTML and not in a Java applet. While the drawing capabilities of DHTML are not as robust as those available in Java, you can position and move an element on the page and give that element a z-order to control what draws above and below it. By adding the appropriate JScript™ or VBScript to your page, you could get a similar effect purely using DHTML.
      Another option is to modify the Java code itself so that it displays the text you want to use. This puts the animation and the text rendering again into the same display engine, reducing the complexity problem.
      The approach I recommend is, instead of using the snow as a background to your page, use it as a border or as a banner so that it doesn't conflict with any of the other text on your page. I think this effect would be far more pleasing to your users. After all, you are designing the page for them, aren't you?

GEEK Internet Explorer 4.0 won't display framesets with body information, which makes it really hard to view pages that are already published. Edit won't open those pages. Is there a patch or anything I can do to fix this problem?
      Also, I am having trouble with text "ghosting" in Internet Explorer 4.0. Half of the text appears where it is meant to be, and half appears on the other side of the page, or even in the middle of a paragraph. Text also has a very faint outline on it. Both of those problems can be temporarily fixed by scrolling down, then back up again, or selecting the affected text. But it still ghosts after that with the highlighted text.

GEEK If by "won't display framesets with body information," you mean a page such as

<html>
 <body>
 <frameset>
 </frameset>
 </body>
</html>
won't display your frames, then this is by design and there are no workarounds. A Web page is either a content page or a frameset page. The <body> and <frameset> elements should be seen as being mutually exclusive. This is how Netscape Navigator (the browser that brought us <frameset>) defines them. It is true that Internet Explorer 3.0 allowed a <frameset> definition to follow the <body> element, but to provide better common functionality across browsers, Internet Explorer 4.0 tightened up their usage of frames and now follows the behavior of Navigator.
      Since Navigator wouldn't have displayed your pages anyway, you need to update your pages to comply with the proper structure of frame definitions.
      As for your problem with text "ghosting," without sample code that would demonstrate this, I'm not sure exactly what your problem is. I do sometimes notice that improperly constructed HTML results in rendering being messed up. I suggest you take a close look at the code of a page you are having trouble with and make sure that everything is constructed properly.

GEEK I have a channel defined in my Web site but it doesn't update itself—I have to update it manually every day. I don't include the "lastmodify" tag in each item or channel tag. Could that be the reason? The other thing is, when I subscribe to the channel, the "Update now" option in the right-click menu sometimes appears and sometimes doesn't. Why?
GEEK If by "my channel doesn't update itself" you mean that the new pages aren't getting cached onto your client machine, then I expect the problem is that your subscription to the site isn't set properly. Your site won't be checked for new pages except at the times you indicated when you subscribed to it. Internet Explorer 4.0 will download a new copy of the CDF (if a new one exists), and it will determine which pages to test by what is listed there. Any pages that have a LASTMOD value that is more recent than the last time the page was checked will be pulled down or marked as new. If there isn't a LASTMOD value supplied, then Internet Explorer 4.0 will touch the page in question and attempt to get the last modification date from your server.
      If the "Update Now" isn't appearing on the context menu for the channel, that means the channel has not been added to the list of subscribed channels properly, in which case a "Subscribe" option will be listed instead of "Update Now". You should verify on your client system that you are fully subscribed to your channel. (From Internet Explorer 4.0, select Favorites | Manage Subscriptions, right-click on your channel, and select Properties.)
      If the channel is subscribed properly and it still isn't getting checked for updates, go into the CDF file on your server and set a couple of LASTMOD values to the current date/time, then go into a couple of pages and make some small modifications so you can verify if the page was actually downloaded. If the pages still don't update based on the subscription information, then your problem is more involved and I would need more information.

GEEK How can I read from and write to a one-line text box from ASP?
GEEK Reading and writing values to a text field on a form is extremely easy. For example, the initial value of a forms text field can be set with code similar to


 <input type="text" name="Company" value="<%=company%>">
which will take whatever value might currently be in your variable company, and use that to define the initial value to be displayed in the text field.
      Once the user has filled out the form and submitted it back to you, the value they entered can be retrieved out of the form fields by code similar to

 <%
 company = Request("Company")
 %>
and then you can do whatever you want with it.
      But I wonder if you really want to know a little bit more than just how to set the initial value and see what the value is once the user has pressed the submit button. I expect you want your server-side ASP code to be involved in the client-side processing throughout the time that the user is working with the page.
      If so, this is something that I have seen confuse several other people. The problem is that your ASP code is run on the server, and it is the output of the ASP code that results in the HTML that is rendered on the client. Once the user sees the page, the ASP has finished its execution and does not have any form of connection to the client by which to modify or otherwise communicate with what the client is doing. To perform actions while the user is using the page, you need to use normal client-side scripting.
      There are tricky ways to create a page with a hidden frame on it that periodically reports back to the server what the user is clicking on, then retrieves additional data and populates the page the user is looking at with more information. . . but it's rather involved.


From the February 1998 issue of Microsoft Interactive Developer.