GEEK I have a very simple piece of code that used to work
on every browser that I have come across. After I installed the Visual InterDev 6.0 beta, my code stopped working. I even tried to go back to a scripting engine that I knew worked, but evidently Visual InterDev replaced some DLLs that I need. The code is just simple HTML (see Figure 1). The error happens on the frm.Elements.count line; I get the error message "Object doesn't support this property or method." I'm using vbscript.dll version 4.0.0.2618.
GEEK The correct way to get the number of items in a
collection is to access the length parameter, so change that line to
For i = 0 to frm.Elements.length - 1
and it should work.
GEEK I want to put a timer on a page that can refresh the page by causing it to reload from the source HTML file. I envision something like this:
<script language="VBScript">
<!--
Sub Refresh_timer
<object>.refresh
End Sub
-->
</script>
According to the documentation I have, the Window and Document objects do not have a refresh method.
GEEK Here's where I go when I want to figure out the method or property that I need:
http://msdn.microsoft.com/psdk/inetsdk/help/dhtml/references/dhtmlrefs.htm
I can also figure out what object exposes it. This provides links to Object, Properties, Methods, and Events, and then it lists all of the names for them, whatever object exposes them. You can then click on the name, which will take you to the documentation for it.
For example, if you click on Methods, then look through that table for "refresh" and click on it, you'll see that the refresh method is only available to a Table object. Dang. That doesn't sound like it does what you want, so let's look for some more possibilities.
Going back to the list, the very next entry is "reload." That sounds promising. Click on that, and you'll see that it is exposed by the location object. Bingo.
To answer your question,
location.reload (true)
is what you want to use. Note that the true value listed will force the content to be reloaded from the server, and not
the cache.
GEEK My question is about giving focus to a text box element on a form. For example, when a form is loaded, I would like to see the cursor start in an element on the form automatically without having to click on that element.
GEEK Setting the focus on a form element is easily done by using the particular element's focus method:
document.forms(index).elements(index).focus
It is best to set the element's focus during the onload event of the <BODY>. Figure 2 is a sample page that will randomly set the focus to an element in a form as the page loads.
GEEK I am using the MSFlexGrid (from Visual Basic® 5.0) in an Active Server Page. The RowHeight property is given in twips and the Height is given in pixels. There aren't any twips-to-pixels conversion routines (except in the Win32® API), and there is no Visual Basic screen object to use for TwipstoPixelsX/Y. Is there some generic way to get the information without having to go to the Win32 API? Why did Microsoft do this to the grid control?
GEEK Any time a conversation crops up about comparing point size and pixels, a fight is sure to break out. A twip is
1/20th of a point, and a point is (approximately) 1/72nd of an inch. Twips are what Visual Basic uses for its internal display resolution, so many Visual Basic elements that might deal with resolution are placed and sized based on this measurement. Twips do not have a direct one-to-one correspondence to pixels because they are related to font size, and this can vary from system to system based on user and screen settings. It's handy to lay out a form using twips because it not only allows the form to automatically adjust its size to conform to user settings, but it also produces the right results on a printout.
GEEK I'm having a problem figuring out just what languages I should be learning for Web development projects. I have no formal computer science background, but can program very efficiently in Macromedia Director. Assuming I want to develop for Site Server technologies, and that I'll only deploy Site Server sites, what do you suggest? My instinct is to learn Visual Basic, but should I also learn Java to build components? If I can only learn one language, does it make more sense to learn Java? But if Visual Basic is the one to tackle, is there any class I should consider that caters to Internet development specifically? Or does a ground-up approach work best?
GEEK Assuming you can learn only one language, you're already out of luck, because you obviously know English, and to the best of my knowledge there aren't any systems (yet) that use English as a programming language.
I would be the last person to recommend that you focus on just a single programming language. Try to learn a smattering of several; each language has its own strengths and weaknesses, and sometimes what takes dozens of lines of code in one language can be done with a single statement in another. A good grasp of these differences and advantages can help you better target your development efforts.
For Internet/intranet development, the main languages to focus on are VBScript, JavaScript, and Java. Note that Java and JavaScript are two totally different languages, and you should never use the term "Java" when you really mean "JavaScript." In fact, the two are probably even more different than "Visual Basic" and "VBScript," which also should not be used interchangeably.
VBScript and JavaScript are both excellent languages to be used inline within HTML. Since VBScript only works with Microsoft® Internet Explorer, JavaScript might be what you want to use if your pages need to work on Netscape Navigator as well. I personally find VBScript a little easier to use. But there are advantages to both languages. If all of your scripting code will be run on the server, then it really doesn't matter what you use, since clients will never need to run it.
If you want to embed simple applets on your pages,
use Java. ActiveX® controls can be written in almost any language, and can have features and functionality beyond the scope of scripts or Java applets. They are also more complex to develop.
GEEK I would like to check the font size of a user's display. I have a page that looks fine when is displays small-size fonts, but if the user sets the system font setting to large-size fonts it fouls up the layout of the page. I would like to check the user's display settings and change the font size accordingly. Is there something similar to a browsertype check scenario available?
GEEK There is absolutely and utterly no way for a Web page to check the font settings of a user's machine. OK, so I suppose you could write an ActiveX control that would provide this information to your Web page, but that's going a little overboard. Try using something like this,
|