November 2005


Classic ASP and VBScript21 Nov 2005 03:31 pm

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.

Javascript15 Nov 2005 01:51 am


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

Javascript14 Nov 2005 04:19 pm

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:

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;
}
}

CSS14 Nov 2005 03:36 pm

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

Uncategorized09 Nov 2005 12:37 pm

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:

SQL Server and ASP.NET08 Nov 2005 04:18 pm

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/