GEEK I am developing Web pages that use ActiveX® buttons instead of a Submit button to capture the submit event. Under Microsoft® Internet Explorer 3.02, pressing the Enter key in a text field generates a submit event. In Internet Explorer 4.0, I can't get this event to fire on forms with more than one text field unless I add a Submit button. I've included a sample that works in Internet Explorer 3.02, but not in Internet Explorer 4.0 (see Figure 1). GEEK Probably the easiest way to trap the Enter key and have it submit a form when one of the form's elements has the focus is to assign an onkeyup event handler for it. Here's an example: |
|
This will invoke the ProcessForm function any time the Enter key is pressed and released while one of the form elements has the focus.
GEEK I have designed an ActiveX control that can be used both within a LAN-based application and through Internet Explorer over the Web. I know I can use the codebase parameter of the <OBJECT> tag to automatically install the control from the Web, but I want to force users to do their first installation over the LAN because the installation package is too complex to run over a dial-up connection. How can I block users who haven't installed the control from accessing the Web page?
|
|
The only time the text within the <OBJECT> container will be rendered is when the object wasn't created for some reason. This provides you with a fairly straightforward way to assist the user in understanding why the control didn't run and the steps they must take to install it.
GEEK I've been trying to write a script to increase font size on an HTML page, but I can't seem to get it to work. My last try was this: |
|
This was called with the following HTML snippet: |
|
GEEK There are two problems with your code. First and foremost, I have a problem with your method of growing the font on a timer. Expanding the font to a maximum size, snapping it back to the initial size, then repeatedly growing it again is extremely annoying. Growing the font size once and then stopping might be acceptable. Might.
Second, the obj.style.fontSize property is a string value. In your particular situation it will look something like "20px." Clearly, trying to execute |
|
won't return anything valid. You need to somehow use a numeric representation of the font size instead of a string representation. The DHTML object model in Internet Explorer 4.0 provides some properties that are numeric representations of other styles normally exposed as strings (posLeft, posTop, posHeight, and posWidth), but it doesn't provide one for fontSize. This exercise is left for the geek.
There are a number of ways to implement this. You could write a function that would strip apart the fontSize value and provide a numeric representation. One minor problem with this technique is that the tag with this style set |
|
will result in exactly what it says: Layer1.style.fontSize will be set to the string "larger," not a point size. I bet you'd have a hard time turning it into a numeric representation.
An easier way to get around this problem is to simply add a custom property to your <DIV> tag, like this: |
|
Then change your code to |
|
which will use this size parameter as the number to be used in maintaining the numeric size of the font.
As I mentioned earlier, this code is extremely annoying, so I recommend using this bare minimum procedure: |
|
This will grow the font size once, then return it to its original size before stopping.
GEEK How can I automatically print several dynamically
generated Web pages from my program? I tried using the Web-Browser object and either JScript® or VBScript, but I cannot print the contents of the WebBrowser object by itself. The OLE print command prints the entire visible browser page, including my embedded WebBrowser object.
|
|
should produce a printout of the Microsoft home page.
As for managing the printout of multiple pages, perhaps the best way to do this is for your ASP pages to realize that they are being asked to produce a printout, and to behave differently under that situation. They could actually generate one long page that includes all of the information that would normally be spread across several pages. You can utilize the CSS page-break-before style to assist with this: |
|
One way to do this would be to expose a special Print button. Clicking on this button would redirect navigation to the special printable version of the pages before printing them out. Depending on how you are providing your solution, you could even have the Print button load the page into an off-screen or hidden instance of a WebBrowser control and print from there. This would keep the user from being bothered by the browser window switching around.
|