<input name="keys"  type="text" id="gkeys"  style="color:#666;" onfocus="javascript:if (this.value='赛奥迪'){this.value=''}"  value="赛奥迪" /><input name="" type="image" src="images/google.gif" onclick="window.open('http://www.google.com.hk/search?q="+document.getElementById('gkeys').value+"')" />
我试来试去, 都不行。 要么缺少 ), 要么字符串未结束啥的。求指导,求安慰!

解决方案 »

  1.   

    TRY:
    <input name="" type="image" src="images/google.gif" onclick="window.open('http://www.google.com.hk/search?q='+document.getElementById('gkeys').value+')'" />
      

  2.   

    <input name="keys" type="text" id="gkeys" style="color:#666;" onfocus="javascript:if (this.value='赛奥迪'){this.value=''}" value="赛奥迪" /><input name="" type="image" src="images/google.gif" onclick=window.open('http://www.google.com.hk/search?q='+document.getElementById('gkeys').value) />
      

  3.   


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    </head><body>
    <input name="keys" type="text" id="gkeys" style="color:#666;" onfocus="javascript:if (this.value='赛奥迪'){this.value='';}" value="赛奥迪" /><input name="bt1" id="bt1" type="image" src="images/google.gif" />
    <script type="text/javascript">
         document.getElementById('bt1').onclick=function(){
           var s="http://www.google.com.hk/search?q="+document.getElementById('gkeys').value;
       window.open(s);
       
     }
    </script>
    </body>
    </html>
      

  4.   

     
    missing ) after argument list
    [Break on this error] window.open('http://www.google.com.hk/...ment.getElementById('gkeys').value+')'