Question : identical javascript code works in one website but not in another?

I have a piece of code in one website that looks like this:

1:
2:
3:
var BillingOwner =  document.getElementById("ddlSearchBillingOwner");
var strBillingOwner = BillingOwner.options[BillingOwner.selectedIndex].value.trim()


In another unrelated website where i'm doing a similar thing it looks like

1:
2:
3:
var BillingAnalyst =  document.getElementById("ddlBillingAnalyst");
var strBillingAnalyst = BillingAnalyst.options[BillingAnalyst.selectedIndex].value.trim()


The first piece of javascript in the first website works fine... the second piece of code in the second website throws an error saying 'object doesn't support this property or method'. If I remove .trim() then the error no longer occurs. So the trim() is presumably causing a problem.

My question then is why... everything else is the same... i use IE7 for both and run on the same computer with the same everything. Why would this happen?

Answer : identical javascript code works in one website but not in another?

actually the second between will not be the best approach because it will consider both ends of the interval so @ID 2 and 3 will overlap.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
USE [NewFlorist]
GO
/****** Object:  StoredProcedure [dbo].[HomePageProducts]    Script Date: 07/22/2010 16:28:36 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[ProductPriceSearch] 
@SiteID int,
@ID int
AS
BEGIN
SET NOCOUNT ON;
select
P.ID ProductiD, 
P.ProductName,
P.ProductPhoto,
LEFT(P.ProductDescription, 44) +'...' ProductDescription,
S.Price
from dbo.Product P
inner join dbo.ProductSelect S
on S.ProductID = P.ID
where 
P.FloristID = @SiteID 
and P.HP = 'Y' 
and S.PriceDescription = '1'
AND (	(@ID = 1 and S.Price < 25) or
	(@ID = 2 and S.Price >= 25 and s.Price < 35) or
	(@ID = 3 and S.Price between 35 and 50) or
	(@ID = 4 and S.Price >= 50)
)
END
Random Solutions  
 
programming4us programming4us