Scripting problem

Discussion in 'ASP General' started by scott cooper, Apr 2, 2005.

  1. scott cooper

    scott cooper Guest

    Can someone help me understand why this script sets only some of the
    div.InnerText proerties of my page. If I set the language to VBScript and
    remove the semicolons it works. I'm just getting started with javascript so
    I appologize it this so simple.

    <script language="javascript">
    oFirstName.InnerText = <%=chr(34)&sFirstName&chr(34)%>;
    oLastName.InnerText = <%=chr(34)&sLastName&chr(34)%>;
    oMI.InnerText = <%=chr(34)&sMiddleName&chr(34)%>;
    oEmpIDFld.InnerText = <%=chr(34)&sEmployeeID&chr(34)%>;
    oTitleField.InnerText = <%=chr(34)&sTitle&chr(34)%>;
    oDepartField.InnerText = <%=chr(34)&sDepartment&chr(34)%>;
    oDivisionField.innerText = <%=chr(34)&sDivision&chr(34)%>;
    oCompanyField.innerText = <%=chr(34)&sCompany&chr(34)%>;
    oTelephone.innerText = <%=chr(34)&sTelephone&chr(34)%>;
    oFaxPhone.innerText = <%=chr(34)&sFaxPhone&chr(34)%>;
    oMobilePhone.innerText = <%=chr(34)&sMobile&chr(34)%>;
    oStreet.innerText = <%=chr(34)&sStreetAddr&chr(34)%>;
    oCityField.innerText = <%=chr(34)&sCityName&chr(34)%>;
    oState.innerText = <%=chr(34)&sState&chr(34)%>;
    oZipCodeFld.innerText = <%=chr(34)&sZipCode&chr(34)%>;
    oLocationFld.innerText = <%=chr(34)&sLocationCode&chr(34)%>;
    oEMailField.innerText = <%=chr(34)&sEMailAddr&chr(34)%>;
    oWebLinkField.innerText = <%=chr(34)&sWebLink&chr(34)%>;
    oDisplayName.innerText = <%=chr(34)&sDisplayName&chr(34)%>;
    oAssistant.innerText = <%=chr(34)&sAssistant&chr(34)%>;
    oTeamURL.innerText = <%=chr(34)&sTeamWeb&chr(34)%>;
    oThumnailPhoto.src = <%=chr(34)&bBinObject&chr(34)%>;
    </script>
    scott cooper, Apr 2, 2005
    #1
    1. Advertising

  2. scott cooper

    McKirahan Guest

    "scott cooper" <> wrote in message
    news:...
    > Can someone help me understand why this script sets only some of the
    > div.InnerText proerties of my page. If I set the language to VBScript and
    > remove the semicolons it works. I'm just getting started with javascript

    so
    > I appologize it this so simple.
    >
    > <script language="javascript">
    > oFirstName.InnerText = <%=chr(34)&sFirstName&chr(34)%>;
    > oLastName.InnerText = <%=chr(34)&sLastName&chr(34)%>;
    > oMI.InnerText = <%=chr(34)&sMiddleName&chr(34)%>;
    > oEmpIDFld.InnerText = <%=chr(34)&sEmployeeID&chr(34)%>;
    > oTitleField.InnerText = <%=chr(34)&sTitle&chr(34)%>;
    > oDepartField.InnerText = <%=chr(34)&sDepartment&chr(34)%>;
    > oDivisionField.innerText = <%=chr(34)&sDivision&chr(34)%>;
    > oCompanyField.innerText = <%=chr(34)&sCompany&chr(34)%>;
    > oTelephone.innerText = <%=chr(34)&sTelephone&chr(34)%>;
    > oFaxPhone.innerText = <%=chr(34)&sFaxPhone&chr(34)%>;
    > oMobilePhone.innerText = <%=chr(34)&sMobile&chr(34)%>;
    > oStreet.innerText = <%=chr(34)&sStreetAddr&chr(34)%>;
    > oCityField.innerText = <%=chr(34)&sCityName&chr(34)%>;
    > oState.innerText = <%=chr(34)&sState&chr(34)%>;
    > oZipCodeFld.innerText = <%=chr(34)&sZipCode&chr(34)%>;
    > oLocationFld.innerText = <%=chr(34)&sLocationCode&chr(34)%>;
    > oEMailField.innerText = <%=chr(34)&sEMailAddr&chr(34)%>;
    > oWebLinkField.innerText = <%=chr(34)&sWebLink&chr(34)%>;
    > oDisplayName.innerText = <%=chr(34)&sDisplayName&chr(34)%>;
    > oAssistant.innerText = <%=chr(34)&sAssistant&chr(34)%>;
    > oTeamURL.innerText = <%=chr(34)&sTeamWeb&chr(34)%>;
    > oThumnailPhoto.src = <%=chr(34)&bBinObject&chr(34)%>;
    > </script>


    Change
    <script language="javascript">
    to
    <script type="text/javascript">

    Try enclosing the ASP in quotes; for example:
    oFirstName.InnerText = "<%=chr(34)&sFirstName&chr(34)%>";

    I haven't worked with .innerText so I can't help you there (yet).
    McKirahan, Apr 2, 2005
    #2
    1. Advertising

  3. scott cooper

    scott cooper Guest

    Thank you for the answer but that didnt work.

    "McKirahan" <> wrote in message
    news:...
    > "scott cooper" <> wrote in message
    > news:...
    >> Can someone help me understand why this script sets only some of the
    >> div.InnerText proerties of my page. If I set the language to VBScript and
    >> remove the semicolons it works. I'm just getting started with javascript

    > so
    >> I appologize it this so simple.
    >>
    >> <script language="javascript">
    >> oFirstName.InnerText = <%=chr(34)&sFirstName&chr(34)%>;
    >> oLastName.InnerText = <%=chr(34)&sLastName&chr(34)%>;
    >> oMI.InnerText = <%=chr(34)&sMiddleName&chr(34)%>;
    >> oEmpIDFld.InnerText = <%=chr(34)&sEmployeeID&chr(34)%>;
    >> oTitleField.InnerText = <%=chr(34)&sTitle&chr(34)%>;
    >> oDepartField.InnerText = <%=chr(34)&sDepartment&chr(34)%>;
    >> oDivisionField.innerText = <%=chr(34)&sDivision&chr(34)%>;
    >> oCompanyField.innerText = <%=chr(34)&sCompany&chr(34)%>;
    >> oTelephone.innerText = <%=chr(34)&sTelephone&chr(34)%>;
    >> oFaxPhone.innerText = <%=chr(34)&sFaxPhone&chr(34)%>;
    >> oMobilePhone.innerText = <%=chr(34)&sMobile&chr(34)%>;
    >> oStreet.innerText = <%=chr(34)&sStreetAddr&chr(34)%>;
    >> oCityField.innerText = <%=chr(34)&sCityName&chr(34)%>;
    >> oState.innerText = <%=chr(34)&sState&chr(34)%>;
    >> oZipCodeFld.innerText = <%=chr(34)&sZipCode&chr(34)%>;
    >> oLocationFld.innerText = <%=chr(34)&sLocationCode&chr(34)%>;
    >> oEMailField.innerText = <%=chr(34)&sEMailAddr&chr(34)%>;
    >> oWebLinkField.innerText = <%=chr(34)&sWebLink&chr(34)%>;
    >> oDisplayName.innerText = <%=chr(34)&sDisplayName&chr(34)%>;
    >> oAssistant.innerText = <%=chr(34)&sAssistant&chr(34)%>;
    >> oTeamURL.innerText = <%=chr(34)&sTeamWeb&chr(34)%>;
    >> oThumnailPhoto.src = <%=chr(34)&bBinObject&chr(34)%>;
    >> </script>

    >
    > Change
    > <script language="javascript">
    > to
    > <script type="text/javascript">
    >
    > Try enclosing the ASP in quotes; for example:
    > oFirstName.InnerText = "<%=chr(34)&sFirstName&chr(34)%>";
    >
    > I haven't worked with .innerText so I can't help you there (yet).
    >
    >
    scott cooper, Apr 2, 2005
    #3
  4. What is the reason that you're doing this? What's oFirstname? A span or a
    div somewhere? Why not just write it out like:

    <html>
    <body>
    <span id="oFirstname"><%=sFirstname%></span>
    </body>
    </html>

    Also, get in the habit now of using spaces between operators.

    <%=Chr(34) & sFirstname & Chr(34)%>

    If you don't use spaces, you'll run into trouble when you have a variable
    name that starts with H, since &h is the prefix for a hexadecimal number.

    Ray at home


    "scott cooper" <> wrote in message
    news:...
    > Can someone help me understand why this script sets only some of the
    > div.InnerText proerties of my page. If I set the language to VBScript and
    > remove the semicolons it works. I'm just getting started with javascript
    > so I appologize it this so simple.
    >
    > <script language="javascript">
    > oFirstName.InnerText = <%=chr(34)&sFirstName&chr(34)%>;
    > oLastName.InnerText = <%=chr(34)&sLastName&chr(34)%>;
    > oMI.InnerText = <%=chr(34)&sMiddleName&chr(34)%>;
    > oEmpIDFld.InnerText = <%=chr(34)&sEmployeeID&chr(34)%>;
    > oTitleField.InnerText = <%=chr(34)&sTitle&chr(34)%>;
    > oDepartField.InnerText = <%=chr(34)&sDepartment&chr(34)%>;
    > oDivisionField.innerText = <%=chr(34)&sDivision&chr(34)%>;
    > oCompanyField.innerText = <%=chr(34)&sCompany&chr(34)%>;
    > oTelephone.innerText = <%=chr(34)&sTelephone&chr(34)%>;
    > oFaxPhone.innerText = <%=chr(34)&sFaxPhone&chr(34)%>;
    > oMobilePhone.innerText = <%=chr(34)&sMobile&chr(34)%>;
    > oStreet.innerText = <%=chr(34)&sStreetAddr&chr(34)%>;
    > oCityField.innerText = <%=chr(34)&sCityName&chr(34)%>;
    > oState.innerText = <%=chr(34)&sState&chr(34)%>;
    > oZipCodeFld.innerText = <%=chr(34)&sZipCode&chr(34)%>;
    > oLocationFld.innerText = <%=chr(34)&sLocationCode&chr(34)%>;
    > oEMailField.innerText = <%=chr(34)&sEMailAddr&chr(34)%>;
    > oWebLinkField.innerText = <%=chr(34)&sWebLink&chr(34)%>;
    > oDisplayName.innerText = <%=chr(34)&sDisplayName&chr(34)%>;
    > oAssistant.innerText = <%=chr(34)&sAssistant&chr(34)%>;
    > oTeamURL.innerText = <%=chr(34)&sTeamWeb&chr(34)%>;
    > oThumnailPhoto.src = <%=chr(34)&bBinObject&chr(34)%>;
    > </script>
    >
    Ray Costanzo [MVP], Apr 2, 2005
    #4
  5. scott cooper

    scott cooper Guest

    Thanks that is MUCH simpler.
    "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
    message news:%...
    > What is the reason that you're doing this? What's oFirstname? A span or
    > a div somewhere? Why not just write it out like:
    >
    > <html>
    > <body>
    > <span id="oFirstname"><%=sFirstname%></span>
    > </body>
    > </html>
    >
    > Also, get in the habit now of using spaces between operators.
    >
    > <%=Chr(34) & sFirstname & Chr(34)%>
    >
    > If you don't use spaces, you'll run into trouble when you have a variable
    > name that starts with H, since &h is the prefix for a hexadecimal number.
    >
    > Ray at home
    >
    >
    > "scott cooper" <> wrote in message
    > news:...
    >> Can someone help me understand why this script sets only some of the
    >> div.InnerText proerties of my page. If I set the language to VBScript and
    >> remove the semicolons it works. I'm just getting started with javascript
    >> so I appologize it this so simple.
    >>
    >> <script language="javascript">
    >> oFirstName.InnerText = <%=chr(34)&sFirstName&chr(34)%>;
    >> oLastName.InnerText = <%=chr(34)&sLastName&chr(34)%>;
    >> oMI.InnerText = <%=chr(34)&sMiddleName&chr(34)%>;
    >> oEmpIDFld.InnerText = <%=chr(34)&sEmployeeID&chr(34)%>;
    >> oTitleField.InnerText = <%=chr(34)&sTitle&chr(34)%>;
    >> oDepartField.InnerText = <%=chr(34)&sDepartment&chr(34)%>;
    >> oDivisionField.innerText = <%=chr(34)&sDivision&chr(34)%>;
    >> oCompanyField.innerText = <%=chr(34)&sCompany&chr(34)%>;
    >> oTelephone.innerText = <%=chr(34)&sTelephone&chr(34)%>;
    >> oFaxPhone.innerText = <%=chr(34)&sFaxPhone&chr(34)%>;
    >> oMobilePhone.innerText = <%=chr(34)&sMobile&chr(34)%>;
    >> oStreet.innerText = <%=chr(34)&sStreetAddr&chr(34)%>;
    >> oCityField.innerText = <%=chr(34)&sCityName&chr(34)%>;
    >> oState.innerText = <%=chr(34)&sState&chr(34)%>;
    >> oZipCodeFld.innerText = <%=chr(34)&sZipCode&chr(34)%>;
    >> oLocationFld.innerText = <%=chr(34)&sLocationCode&chr(34)%>;
    >> oEMailField.innerText = <%=chr(34)&sEMailAddr&chr(34)%>;
    >> oWebLinkField.innerText = <%=chr(34)&sWebLink&chr(34)%>;
    >> oDisplayName.innerText = <%=chr(34)&sDisplayName&chr(34)%>;
    >> oAssistant.innerText = <%=chr(34)&sAssistant&chr(34)%>;
    >> oTeamURL.innerText = <%=chr(34)&sTeamWeb&chr(34)%>;
    >> oThumnailPhoto.src = <%=chr(34)&bBinObject&chr(34)%>;
    >> </script>
    >>

    >
    >
    scott cooper, Apr 2, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark
    Replies:
    3
    Views:
    590
    Joe Smith
    Mar 18, 2005
  2. Shiva

    Re: ascx client scripting problem

    Shiva, Jul 27, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    495
    Shiva
    Jul 27, 2004
  3. Steven Cheng[MSFT]

    RE: ascx client scripting problem

    Steven Cheng[MSFT], Jul 28, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    548
    Steven Cheng[MSFT]
    Jul 28, 2004
  4. Ron Stephens
    Replies:
    23
    Views:
    2,785
    Ron Stephens
    Apr 12, 2004
  5. DaveInSidney
    Replies:
    0
    Views:
    396
    DaveInSidney
    May 9, 2005
Loading...

Share This Page