Using JavaScript in HomeSite 4.0, Part I: The Application Object's Methods, Part II | WebReference

Using JavaScript in HomeSite 4.0, Part I: The Application Object's Methods, Part II


Using JavaScript in HomeSite 4.0, Part I

The Application Object's Methods, Part II

GetImageSize(fullPath, height, width)Boolean

Extracts the passed image's height and width. Does not work when called from JavaScript as it does not match JavaScript's pass-by-reference conventions.

GetRelativePath(basePath, fullPath)String

Extracts the file name of the fullPath relative to the basePath. The method matches the basePath with the fullPath and returns the trailing characters up to and including the last slash or backslash. For example, if basePath is "http://www.webreference.com/" and fullPath is "http://www.webreference.com/js/," the method returns "js/." It returns the same string even if fullPath is "http://www.webreference.com/js/index.html,", because the last slash is still at the same position (after "js"). The method works just as well with local file names. For example, if basePath is "D:\\Tomer\\" and fullPath is "D:\\Tomer\\column48\\index.html," the method returns "column48\." Don't forget to escape all backslashes that you put in your strings.

GetTabIndexForFile(fullPath)Integer

Returns the index of the passed file in the document tab. This method evaluates to -1 if the file isn't open. In the following situation, if fullPath is assigned "E:\\Tomer\\column48\\test.js," the GetTabIndexForFile() method returns 1 (because it is the second file in the document tab):

Several Tabs

Note that the document tab is zero-based. In other words, the first document is 0, the second one is 1, the third one is 2, and so forth.

GetURL(URL)String

Returns the HTML content of the passed URL.

http://www.internet.com

Produced by Yehuda Shiran and Tomer Shiran

Created: September 13, 1999
Revised: September 17, 1999

URL: http://www.webreference.com/js/column48/appmet2.html