Pass a Value from Page_Load to a Java Function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rambaldi
    New Member
    • Mar 2007
    • 42

    Pass a Value from Page_Load to a Java Function

    Is this possible???

    When i call another web page i receive a value from it:

    Code:
    //1st Page
    Session["nCam"] = camLenght;
    Code:
    //2nd page -> receive the value from the first page on Page_Load()
    int nCam = Convert.ToInt32(Session["nCam"]);
    then i call a java function from the body tag:

    Code:
    <body onload="MontagemCamaras()">
    The question is: is that possible to use the value from the second page to be an input for the java function?? how can i do it???

    Tell me if i wasnt quite clear on this. Thanks in advance.
  • DrBunchman
    Recognized Expert Contributor
    • Jan 2008
    • 979

    #2
    Hi Rambaldi,

    I presume as we are discussing web development that by Java you actually mean Javascript?? There is a massive difference between the two and it's important to be precise about it.

    Assuming that you do mean Javascript then you can pass a variable into your javascript function using the server tags (<% %>) like this:

    Code:
    <body onload="MontagemCamaras(<%=nCam%>)">
    Hope this helps,

    Dr B

    Comment

    • Rambaldi
      New Member
      • Mar 2007
      • 42

      #3
      Hi DrBunchman, thanks for your reply.

      I mean Javascript, I’m sorry. In my country, we just say Java to abbreviate. I will be more careful when i put my questions in foreign forums.

      Thanks for your answer, it helps me a lot :D

      Comment

      • DrBunchman
        Recognized Expert Contributor
        • Jan 2008
        • 979

        #4
        No problem Rambaldi, glad it helped.

        Comment

        Working...