Why doesn't the window slab.location.href



  • Here's the shape.

    <form id="w0" method="get" action="найти">
        <input type="text" placeholder="Поиск" value="" name="query">
        <div class="form-group">
            <button onclick="window.location.href=this.form.action+'-'+this.form.query.value" type="submit">
                <i class="fa fa-search"></i>
             </button>
        </div>
    </form>
    

    I'm getting this address on button. http://film.lc/%найти?query=запросIf I do that,

    <form id="w0" method="get" action="найти">
            <input type="text" placeholder="Поиск" value="" name="query">
            <div class="form-group">
                <button onclick="alert(window.location.href=this.form.action+'-'+this.form.query.value)" type="submit">
                    <i class="fa fa-search"></i>
                 </button>
            </div>
        </form>
    

    After a while, if you don't push the alert window on the window,location.href will work and I'll get this address. http://film.lc/%D0%BD%D0%B0%D0%B9%D1%82%D0%B8-%D0%B7%D0%B0%D0%BF%D1%80%D0%BE%D1%81 ♪ Why don't you tell me how to fight it first?



  • Ooh. button I' bet. type="submit"♪ In the click on the button, the form is being sent here, so it seems that the processor onclick where the location doesn't work.

    In the case of alerant, the main processing cycle shall be braked when the alerant is performed, the parameter to which the location is calculated and changed.

    The meaning of such a processor is not clear. Either you need to replace type="submit"type="button"or remove onclick


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2