-2

i still have problem in my code. i want the Java get the string froom the input text field and compare to another string, it´s true, send to some url. i did this code, but it doesn´t work.

<input type="text" name="procura" id="pro" value="" />


 <script language="JavaScript">
 function ver(){
    var pp = document.getElementById('pro').value;
  if (pp.equals('advogados'))
 {
     window.location = "http://www.jornalexemplo.com.br"
     //do something
 };
 };


  </script>

  </div></td>
                    <td width="399"><input type="submit" name="Busca" id="Busca"    value="AWR Procura" onsubmit="ver()"; /></td>
4

2 回答 2

0

更改类型button代替submit。调用那个方法onClick

<input type="button" name="Busca" id="Busca"    value="AWR Procura" onClick="ver()"; />

提交仅在您需要在服务器上发送数据时使用。

于 2013-06-18T18:40:02.980 回答
0

而不是使用pp.equals,使用

if(pp == 'advogados') 

然后它可以正常工作。并将提交按钮更改为按钮并调用该函数

于 2013-08-03T06:31:22.343 回答