0

Hello everyone,

I have a button on a page that is created with the <input> statement - this statement also contains the event handler onClick. The button displays correctly on the page but the event handler is not working - I know this as I put a simple alert at the beginning of the function PrcsBtn1. I am very new to all of this - what have I missed?

<script type="text/javascript" language="javascript">
         function PrcsBtn1()
           {
             var data2 = new Array();
             data2[0] = "Cancel Appointment";

             var packedS="";
             for (i = 0; (i < data2.length); i++)
                {
                   if (i > 0)
                      {
                        packedS += ",";
                      }
                   packedS += escape(data2[i]);
                }

                window.location = "mypage11 new.html?"+packedS;
                window.open = "mypage11 new.html?"+packedS;
           }
    </script>

    <input name="b1" type="button" value="CANCEL APPOINTMENT" document.apptcalendar.b1.onClick="javascript:PrcsBtn1();">
2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by LoriM
0

Get rid of the the extra stuff befor the event attribute. So it should look like this:

<input name="b1" type="button" value="CANCEL APPOINTMENT" document.apptcalendar.b1.onClick="javascript:PrcsBtn1();">

You also don't need the "javascript:"

So this is what it turns to:

<input name="b1" type="button" value="CANCEL APPOINTMENT" onClick="PrcsBtn1();">
0

Wow! Thanks loads...I think I'm finally catching on to this JavaScript stuff - not bad for an old mainframe programmer. Again, many, many thanks.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.