日期:2014-05-20  浏览次数:20704 次

如何在javascript里面获取 struts2标签的 <s:hidden /> 的值
Java code

 <style type="text/css" media="screen"> 
            html, body    { height:100%; }
            body { margin:0; padding:0; overflow:auto; }   
            #flashContent { display:none; }
        </style> 
        <script type="text/javascript" src="js/swfobject/swfobject.js"></script>
        <script type="text/javascript" src="js/flexpaper_flash.js"></script>
        <script type="text/javascript"> 
            var swfVersionStr = "10.0.0";
            var xiSwfUrlStr = "playerProductInstall.swf";
            alert(1);
              var applyResource = document.getElementById("apply").innerHTML;
              alert(2);
              alert(applyResource);
            var flashvars = { 
                  SwfFile : escape("resource/type/applyResource"),
                  Scale : 0.6, 
                  ZoomTransition : "easeOut",
                  ZoomTime : 0.5,
                    ZoomInterval : 0.1,
                    FitPageOnLoad : false,
                    FitWidthOnLoad : true,
                    PrintEnabled : false,
                    FullScreenAsMaxWindow : false,
                    ProgressiveLoading : true,
                    
                    PrintToolsVisible : true,
                    ViewModeToolsVisible : true,
                    ZoomToolsVisible : true,
                    FullScreenVisible : true,
                    NavToolsVisible : true,
                    CursorToolsVisible : true,
                    SearchToolsVisible : true,
                    
                    localeChain: "en_US"
                  };
                  
             var params = {
                
                }
            params.quality = "high";
            params.bgcolor = "#ffffff";
            params.allowscriptaccess = "sameDomain";
            params.allowfullscreen = "true";
            var attributes = {};
            attributes.id = "FlexPaperViewer";
            attributes.name = "FlexPaperViewer";
            swfobject.embedSWF(
                "FlexPaperViewer.swf", "flashContent", 
                "960", "600",
                swfVersionStr, xiSwfUrlStr, 
                flashvars, params, attributes);
            swfobject.createCSS("#flashContent", "display:block;text-align:left;");
        </script> 
</head>

<body>
<%@ include file="top1.jsp" %>
<div id="wrapper">

  <ul id="menu">
       <li><a href="excellentCourse_list.jsp">首页</a></li>
       <li><a href="">精品课程一览</a></li>
      
      <s:iterator value="listcl">
      <li ><a href="CourseLevel!getClApply?clid=<s:property value="clId" />"><s:property value="clApply" /></a></li>
        
        <s:hidden name="apply" value="%{clApplyResource}" />
     </s:iterator>
  </ul>
 <div >
        <div id="flashContent"> 
                
        </div>
</div>
</div>





这是我的 页面 代码 麻烦大家 看一下 急啊 弄了一下午了 没弄出来




------解决方案--------------------
<s:hidden name="apply" value="%{clApplyResource}" />
不要使用value
直接在Action里面直接set某某(apply值);
<s:hidden name="apply" />便可
------解决方案--------------------
<s:hidden name="apply" value="%{clApplyResource}" />