Javascript function call

Discussion in 'PHP' started by deeksha, Nov 14, 2009.

  1. #1
    The function change() in not getting called by onClick event of button Click Me,JavaScript array

    size has been created in PHP
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script type="text/javascript" language="javascript">

    function change()
    {
    alert(size[1][0]);

    }

    </script>

    </head>

    <body>
    <script language="javascript">
    var size = new Array();
    var = count;
    for (count = 0; count < 5; count++)
    size[count] = new Array();
    size[0][0] = 600;
    size[0][1] = 400;
    size[1][0] = 300;
    size[1][1] = 400;
    size[2][0] = 300;
    size[2][1] = 400;
    size[3][0] = 600;
    size[3][1] = 400;
    size[4][0] = 300;
    size[4][1] = 400;
    </script>
    <input type="button" value="Click Me" onClick="change()"/>

    </body>
    </html>

    Anything wrong with my coding,any kind support will be apreciated.

    Thanks,
    Srinivas.
     
    deeksha, Nov 14, 2009 IP
  2. mastermunj

    mastermunj Well-Known Member

    Messages:
    687
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #2
    changes:

    var = count; to var count = 0;
    onClick="change()" to onclick="javascript:change();"

    javascript should be defined as:
    <script type="text/javascript">
    </script>
     
    mastermunj, Nov 14, 2009 IP