java吧 关注:1,292,314贴子:12,823,233
  • 19回复贴,共1

关于script传值

只看楼主收藏回复

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script type="text/javascript">
function bottomForm(){
//这个a的值就是我们在输入框里面的值
var a=document.bf.key.value;
window.open("http://www.baidu.com/s?wd=" + a);
return false;
}
</script>
</head>
<body>
<form name=bf onsubmit="bottomForm()">
<table border="0" cellspacing="1" bgcolor="#52cccc">
<tr>
<td>关键字:<input name="key" value=""></td>
<td><button type="submit">百度一下</button></td>
</tr>
</table>
</form>
</body>
</html>


1楼2016-05-22 11:29回复
    各位大神求助!!
    我想向script中传值
    String[][] candi5 = (String[][])session.getAttribute("candi4");
    把上面那个数组里面的值赋值给a,要怎么实现啊


    2楼2016-05-22 11:30
    回复
      2025-12-23 17:25:22
      广告
      不感兴趣
      开通SVIP免广告
      你不是一个人在战斗.真心学习Java的童鞋们请注意看我的头像


      3楼2016-05-22 11:32
      回复
        别沉贴啊


        4楼2016-05-22 11:52
        回复
          有木有大神知道


          5楼2016-05-22 13:41
          回复
            求救


            6楼2016-05-22 13:41
            回复
              SOS


              7楼2016-05-22 13:42
              回复
                设置id,根据id获取dom对象然后.value,也可以根据name获取数组然后一层层拿


                IP属地:浙江来自Android客户端8楼2016-05-22 13:45
                收起回复
                  2025-12-23 17:19:22
                  广告
                  不感兴趣
                  开通SVIP免广告
                  使用el,${canid4[0][0]}. 不知道是不是这样


                  来自Android客户端9楼2016-05-22 13:46
                  收起回复



                    11楼2016-05-22 18:57
                    收起回复
                      a=new Array(
                      <c:foreach items="${sessionScope.xxx}" var="bo" varStaus="ind">
                      <c:if test="ind=='1' ">${bo.xxx}</c:if>
                      <c:if test="ind!='1' ">,${bo.xxx}</c:if>
                      </c:foreach>
                      );
                      //骚年,我琢磨出的 jstl拼 js语句 怎么样


                      12楼2016-05-22 19:35
                      回复