Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在jsp中使用onchange()或onselect()_Javascript_Html_Jsp - Fatal编程技术网

Javascript 如何在jsp中使用onchange()或onselect()

Javascript 如何在jsp中使用onchange()或onselect(),javascript,html,jsp,Javascript,Html,Jsp,在视图页面中,我们有一些单选按钮,所以点击单选按钮,选择和选项标签将使用scriplets显示值 这是前面的代码: pl_selection=is javascript function hsMap.get("product_line")=getting values from database 单选按钮代码 <input type="radio" name="pl_type" value="pl" onClick="pl_selection('pl');" <% if(pl

在视图页面中,我们有一些单选按钮,所以点击单选按钮,选择和选项标签将使用scriplets显示值

这是前面的代码:

pl_selection=is javascript function
hsMap.get("product_line")=getting values from database
单选按钮代码

 <input type="radio" name="pl_type" value="pl"  onClick="pl_selection('pl');" 
<% if(pl_type.equals("pl")) { %> checked <% } %>><%=hsMap.get("product_line") %>

aLProdline=是java arraylist。 选择和选项标记的代码:

 <% if((pl_type.equals("pl")) || (pl_type.equals(""))) { %>
    <div id="pl_list" style="display:">
    <% } else { %>              
    <div id="pl_list" style="display:none">
    <% } %>
    <select name="prodline" size="8" multiple id="select15" style="width:   250px;">
    <%for(int i=0; i<aLProdline.size();i=i+2){ %> 
    <option value="<%=aLProdline.get(i)%>" <%   if(plx.indexOf((String)aLProdline.get(i))!=-1) { %> selected <% } %>title="   <%=aLProdline.get(i) %> - <%=aLProdline.get(i+1) %>"><%=aLProdline.get(i) %> -     <%=aLProdline.get(i+1) %></option>
    <% }  %>
    <option value="">
    </select>
    </div>

-     
现在我的工作是从scriplets中获取值并使用javascript显示。 我的问题是: 我从属性中获取值,但在以正确方式显示时遇到问题意味着对齐问题。
这是旧代码,我需要用javascript替换。

对齐问题是什么?选择选项是否已填充?在警报消息中,它显示值,但选择和选项标记工作不正常。您的意思是,如果((pl_type.equals(“pl”))| |(pl_type.equals(“”))计算为true,则在警报中显示值,但在
if((pl_type.equals(“pl”)| |(pl_type.equals(“”))时不显示在页面上。如果可以,你能提供另一种在JavaScription中显示值的方法吗?我知道条件是好的,我的问题是当条件为真时是否显示值?