SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast rgf207's Avatar
    Join Date
    Feb 2006
    Location
    Maryland
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    can someone tell me why this javascript won't work

    I have an external .js file with many functions that is included in the <head> of my document. All the other functions in this work but this one. It's a simple function and call but I can't get it to work

    here is the function call
    Code:
    <SELECT id='cat_type' name='cat_type' onchange='category_options();' class='input' ><OPTION value='1' SELECTED>Standard Category</OPTION><OPTION value='2' >External Link</OPTION></SELECT>
    here is the function
    Code:
    /* Enables table cells for category selection */
    function category_options()
    {
    	alert('test');
    
    }
    can someone explain what I'm doing wrong?

    Thanks

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,875
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    There must be some code elsewhere that is interfering as there isn't any reason why that code by itself wouldn't work.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Member
    Join Date
    Apr 2008
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have tried this one and its working, here is the codes:

    <body>
    <script language="javascript">
    function hello(){
    alert("hi there!");
    }
    </script>
    <select onchange="hello()">
    <option value="1">Try 1</option>
    <option value="2">Try 2</option>
    <option value="3">Try 3</option>
    </select>
    </body>
    Oliver Ryan Caliwag
    -Webmaster and Web Developer using
    PHP + MySQL,AJAX, jQuery,JavaScript
    HTML and CSS. SEO Expert

  4. #4
    SitePoint Member
    Join Date
    Apr 2008
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    just add and change appropriate parameters both in javascript codes and in the select tags. Thanks. I hope t helps....
    Oliver Ryan Caliwag
    -Webmaster and Web Developer using
    PHP + MySQL,AJAX, jQuery,JavaScript
    HTML and CSS. SEO Expert


Bookmarks

Posting Permissions

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