We help IT Professionals succeed at work.
Get Started

error message on page load

tavseth
tavseth asked
on
859 Views
Last Modified: 2007-12-19
Hi,

I have this code, which produces an error message when loaded in the browser (IE6): "Object expected". Typically I would look for a missing semicolon or opening/closing bracket or something like that in the case of such error message, but this time I cannot find such a problem.

Anyone with better eyes than me who can find what is the problem here? Please note that the code is in development and so does not do very much meaningful at this point.

When finished, it will fill a select dropbox with select items from the XML data island, depending on limits chosen in selects "selPrisFra" and "selPrisTil" (select Price From, and select Price To, respectively).

The objective is to download a set of data from the server once, and then get the different sets of options in two dropboxes depending on the selected value in two other (static) dropboxes and the selected value of one of the two dynamic dropboxes... Thus avoiding to use session vars and reload, with overhead on server due to DB access.

See code below.


Kind regards,
Tavseth


<html><head><title>SomeTitle</title>
<style type="text/css"><!--
 [STYLE DEFS] -->
</style>
<script type="text/javascript" language="JavaScript">
<!--
 [FUNCTIONS THAT WORK FINE]

// ---------------------functions that cause error below here---------------------
function fnDeleteItems(objSelect)
{
  var objSel = document.forms[0].elements[objSelect];
  for (i=objSel.length; i>0; i--)
  {
    objSel.options[i]=null;
  }
}

function fnAddItem(objSelect, strValue, strText, strClass)
{
  var ObjSel = document.forms[0].elements[objSelect];
  intLength = objSel.length;
  objSel.options[intLength] = new Option;
  objSel.options[intLength].value = strValue;
  objSel.options[intLength].text = strText;
  objSel.options[intLength].class = strClass;
}

function fnLoadOmrader()
{
  fnDeleteItems('selOmrade');

  var taden = document.forms[0].elements('selPrisFra');
  var iFraHusleie = taden.options[taden.selectedIndex].value;

  var taden = document.forms[0].elements('selPrisTil');
  var iTilHusleie = taden.options[taden.selectedIndex].value;

  var intCount;
 
  for(intCount=0; intCount<10; intCount++)
  {
    if ((iFraHusleie <= 5000) && (iTilHusleie >= 5000))
    {
      fnAddItem('selOmrade', '0301', 'Oslo', 'kommune');
    }
   
  }
}
// ---------------------functions that cause error above here---------------------
// -->
</script>
</head>
<body>
 [XML DATA ISLAND HERE]
 [HTML STUFF INCLUDING FORM1 W/SELECT DROPBOXES HERE]
</body>
</html>
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 3 Answers and 11 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE