none
Help with --- Microsoft JScript runtime error: Object expected error

    Question

  • Hi All,

    Why the Microsoft JScript runtime error: Object expected error???


    Here's scenario....

    Code gets called via:

    <td onClick="Javascript:<%=ChangeConstants(rsfunMenu)%>" class="funmnuItem" level=3 onMouseOver="Hilite(this)" onMouseOut="UnHilite(this)" hiliteColor="#ffffcc" textColor="#000066">


    Function ChangeConstants(rsfunMenu)
     
    .... code below is good returns true etc

    if InStr(rsfunMenu("Function_Code").Value, "%tournee_step1%") => 0 then
            ChangeConstants = "href('ASPX/Tournee.aspx')"
    end if

    End Function

    Resultiing output after function:

    <td onClick="Javascript:href('ASPX/Tournee.aspx')" class="funmnuItem" level=3 onMouseOver="Hilite(this)" onMouseOut="UnHilite(this)" hiliteColor="#ffffcc" textColor="#000066">Créer tournée</td>

    When I click on link result is:
    Microsoft JScript runtime error: Object expected

    Please oh please tell me why???

    Thank You!
    Wednesday, October 17, 2012 3:21 PM

Answers

  • Hi Burton,

    From your description, I think this error means there is no href function defined. As we know href is a  property, but here you use it as a function.

    If you just want to redirect to Tournee.aspx by click action, you can modify your code like below:

     
    <td onClick="Javascript:<%=ChangeConstants(rsfunMenu)%>" class="funmnuItem" level=3 onMouseOver="Hilite(this)" onMouseOut="UnHilite(this)" hiliteColor="#ffffcc" textColor="#000066">
    Créer tournée
    </td>
    <script >
          function href(s) {
              window.open(s); //open Tournee.aspx 
              parent.close();//Close current page
          }
    </script>

    Regards,


    Lisa Zhu [MSFT]
    MSDN Community Support | Feedback to us

    Friday, October 19, 2012 6:17 AM