www.webdeveloper.com
Results 1 to 2 of 2

Thread: Onclick is not working in IE & Safari

  1. #1
    Join Date
    Sep 2010
    Posts
    3

    Onclick is not working in IE & Safari

    Hi,

    Below code is not working in IE and Safari. But its working in Firefox. Is there any problem in this code.

    <html>
    <head>
    <script type="text/javascript">
    function redirect(url)
    {
    alert(url);
    }
    </script>
    </head>
    <body>
    <select name='select'>
    <option onclick="redirect('url1');">Points</option>
    <option onclick="redirect('ur2');">VIP</option>
    <option onclick="redirect('ur3');">Bank</option>
    <option onclick="redirect('url4');">Lottery</option>
    <option onclick="redirect('url5');">Bold Username</option>
    </select>
    </body>
    </html>

    Please any one assist me.

    Thanks
    Tamilmani Mohan

  2. #2
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    IE does not support events in OPTION elements. You should use onchange applied upon the SELECT parent element:
    Code:
    <select name="select" onchange="redirect(this.value)">
    <option value="url1">Points</option>
    <option value="url2">VIP</option>
    <option value="url3">Bank</option>
    <option value="url4">Lottery</option>
    <option value="url5">Bold Username</option>
    </select>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles