저는 rhostudio를 사용하여 모바일 앱을 만듭니다. 현재 나는 내가 button.each의 텍스트 필드를 누르면 일단 내가 다른 이름을 가지고 value.same은 함수 호출에 대한 매개 변수로 버튼 값의 값으로가는 함수 호출을 호출 코드다른 텍스트 필드 (rhodes 및 java)에 값을 쓰고 싶습니다
<div data-role="page">
<script type="text/javascript">
function call(harga,nama){
var quantity=prompt("Insert Quantity");
var pri=harga;
var nam="document.form1."+nama;
alert("unit price RM" + pri+".00");
price= quantity * pri;
alert(quantity);
alert("total price RM" + price+".00");
alert("total price RM" + price+".00" + " should be displayed into " + nam +" textfield");
document.form1."name".value = quantity;
nam.value = quantity;
document.form1."name".value = "RM " + price;
// document.form1.hidden3.value = nam;
}
</script>
<div data-role="header" data-position="inline">
<h1>Displays</h1>
<a href="<%= Rho::RhoConfig.start_path %>" class="ui-btn-left" data-icon="home" data-direction="reverse" <%= "data-ajax='false'" if is_bb6 %>>
Home
</a>
<a href="<%= url_for :action => :new %>" class="ui-btn-right" data-icon="plus">
New
</a>
</div>
<div data-role="content">
<form name="form1">
<table>
<tr align="center">
<td>Product</td>
<td>Quantity</td>
<td>Total Price</td></tr>
<% @products.each do |product| %>
<tr align="center">
<td><%= product.name %></td>
<td><input type="text" name="<%= product.name %>" value="textfield <%= product.name %>"></td>
<td><input type="text" name="<%= product.price %>" value="textfield <%= product.price %>"></td>
</tr>
<% end %>
</table>
<br/>
<br/>
<% @products.each do |product| %>
<input type="hidden" value="price :<%= product.price %>" name="harga"/>
<input type="button" onclick="call(<%= product.price%>,value);" name="Press" value="<%= product.name %>">
<% end %>
</form>
</div>
</div>
의 종류가 않습니다. call() 함수로 계산 된 결과를 특정 텍스트 필드에 쓰는 것을 권장합니다. 불행히도, 그렇지 않습니다! 도와주세요 ..
각 텍스트 필드는 다른 이름을 가지고 있으며 생성 된 개체를 기반으로합니다. 왜냐하면 나는 많은 텍스트 파일을 개체의 양을 기반으로 만들었습니다, 다른 이름을 가지고 그 텍스트 필드에 결과를 작성하는 것입니다. 불행히도, 그것을하지 않습니다! 도와주세요 ..