Nov
21
2005
12

VBScript Array Length

Apparently there is no direct method to determine the length of an array in VBScript. The best way I could find is to use UBound(ArrayName). This will return the upper limit of the array. Unfortunately, it doesn’t account for empty items in the array. In the example below Length will be equal to 10, not 1.

Dim NewArray(10)
NewArray(0) = "Apple"
Length = UBound(NewArray) ‘Length is equal to 10, not 1

Here is a good link to VBScript Array functions.

http://www.shocknet.org.uk/defpage.asp?pageID=30

If you know of a better way to determine the length, please let me know.

Written by Tom in: Classic ASP,VBScript |
Nov
15
2005
--

Javascript InStr function


Is there a function in Javascript that is the same as VBScript’s instr? Yes! It’s string.indexOf

For info on how to use it, check out DevGuru’s page on IndexOf

Written by Tom in: Javascript |
Nov
14
2005
3

Replacing Checkboxes and Radio Button’s Programmically with Javascript

There is a great article and javascript on CodeProject.com. The code was originally written by BrainError.

I had to add support for labels, however. If you had a label like this:
<label for="CheckBoxID"></label>

it wouldn’t update the image if you clicked it. I added the following to the js file:

In function replaceChecks, I added one line: inputs[i].onclick = new Function(‘imgChange(‘+i+’)');

Here’s the relevant section of code:

//set image
if(!inputs[i].disabled) {
img.onclick = new Function('checkChange('+i+')');
inputs[i].onclick = new Function('imgChange('+i+')');
}

I also had to add a separate function here:


//change the image if the checkbox is changed.
function imgChange(i) {

if(inputs[i].checked) {
document.getElementById('checkImage'+i).src=imgCheckboxTrue;
} else {
document.getElementById('checkImage'+i).src=imgCheckboxFalse;
}
}

Written by Tom in: Javascript |
Nov
14
2005
3

CSS Hand Cursor (clickable)

I have in the past wanted to have the cursor look like it was hovering over a link when it was not in fact over an link. As you know, when the cursor is over a link it shows up as a hand. Well, what if you want them to click something that isn’t a link – how do you communicate that it is clickable.

The answer is cursor:hand for Internet Explorer (IE) and cursor:pointer for Mozilla and Netscape (NS).

Here’s the cross browser CSS:

p.pointerhand {
cursor: pointer;
cursor: hand;
}

More information on cursor styles: http://www.quirksmode.org/css/cursor.html

Written by Tom in: CSS |
Nov
09
2005
--

Google Adsense

Adsense HomeGoogle Adsense analyzes the content of your page, matches it to their existing advertisers and then displays the advertisements that your visitor might actually be interested in. All you have to do is copy/paste a piece of javascript code into your template. You’ll probably have noticed adsense on this blog underneath certain posts.

To sign up for Google Adsense, use the link below:

Written by Tom in: Uncategorized |
Nov
08
2005
0

Visual Studio Express for Free

Microsoft is celebrating the launch of Visual Studio Express by offering it for free for the first year. This includes their Visual Web Developer 2005 Express Edition. This is a great light-weight tool for .NET 2.0 development. I’ve been using the beta version of it for the past couple of months.

Here’s the link to the download site: http://msdn.microsoft.com/vstudio/express/

Written by Tom in: ASP.NET,SQL Server |

Powered by WordPress | Aeros Theme | TheBuckmaker.com WordPress Themes