SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2010
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    This Javascript is not working on chrome....please help

    HTML Code:
    <script type="text/javascript">
    function jsFunction2()
    {  
      var myselect = refine2.options[refine2.selectedIndex].value;
      //window.location.href = 'view.php?refine2='+myselect;
      if(myselect==7)
      {
    	  document.getElementById("searchbox").style.display = "block";
      	
      }
      else
      {
    	  window.location.href = 'view.php?refine2='+myselect;
      }
    }
    </script>
    
     <select onChange="javascript: jsFunction2()" id="refine2" name="refine2">
                  <option value="">---Select---</option>
    <option selected="selected" value="1" >Today</option>
                  		<option value="2">Yesterday</option>
                        <option value="3">This Week</option>
                        <option value="4">Last Week</option>
                        <option value="5">This Month</option>
                        <option value="6">Last Month</option>
                        <option value="7">Custom</option>
                        <option value="8">All</option>
    </select>
    Thanks....

  2. #2
    SitePoint Member
    Join Date
    Sep 2013
    Posts
    13
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I don't see where the variable 'refine2' is defined.
    Try defining it at the beginning of the function.

    Code:
    var refine2 = document.getElementById('refine2');


    Gotta use that error console Don't know how so many people forget it.

  3. #3
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    6,055
    Mentioned
    219 Post(s)
    Tagged
    12 Thread(s)
    Quote Originally Posted by thetenfold View Post
    Gotta use that error console Don't know how so many people forget it.
    +1

    Here's a brief tutorial.

    Other than that, if the error persists, can you post a link to the page it is on?


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
  •