Ter-ann Grange
Ter-ann Grange

Reputation: 25

Calling a procedure and passing 2 parameters Javascript

I have been trying to pass the following 2 parameters to a procedure during the form load it works with one but not with two can anyone advise?

<body onload="UpdateButton(<%=esr_link%>,<%=job%>)">

 function UpdateButton(Link,Title)
{
if (Link == 1)
{
        alert('Updatebutton=1')
        document.getElementById("staff").innerHTML = "Trust Staff "  + Title

}   
else
{
         document.getElementById("staff").innerHTML = "Non Trust Staff " + Title
}
}

Upvotes: 0

Views: 33

Answers (1)

Timothy Groote
Timothy Groote

Reputation: 8652

the output of this:

<body onload="UpdateButton(<%=esr_link%>,<%=job%>)">

probably looks a little like this :

<body onload="UpdateButton(1,salesman)">

you're missing the quotes around "job". try the following :

<body onload="UpdateButton(<%=esr_link%>,'<%=job%>')">

Upvotes: 1

Related Questions