<?php $array = ['a' => 1, 'b' => 2];?>

<script>
let name = 'a';
let result = "";
<? foreach($array as $key => $val) { ?>
	if("<?=$key?>" == name) {
		result = "<?=$val?>";
	}
<? } ?>
</script>

 

 

 

<tr>
	
	<td rowspan="2">
		<input type="tel" oninput="func_setTime(this)"/>
	</td>
	
	<td class="td_lft">
		<input type="tel" name="p_time[]"/>
	</td>
	
</tr>

<tr>
	
	<td rowspan="3">
		<input type="tel" oninput="func_setTime(this)"/>
	</td>
	
	<td class="td_lft">
		<input type="tel" name="p_time[]"/>
	</td>
	
</tr>
function func_setTime(el) {
	
	var idx = $(el).closest("tr").index();
	var rowspan = Number($(el).closest("td").attr('rowspan'));
	var total = idx+rowspan;
	return $("input[name='p_time[]']").slice(idx,total).val(el.value);

}

작업전에 1을 넣으면 rowspan 에 묶어있는 데이터 1 을 주고

작업후에 2를 넣으면 rowspan 에 묶어있는 데이터 2 를 준다.

 

 

 

function f_auto_sum(obj) {
    let buy = $(obj).parent().parent().find("input[name='buy[]']").val();
    let used = $(obj).parent().parent().find("input[name='used[]']").val();
    let jaego =  $(obj).parent().parent().find("input[name='jaego[]']");

    if(!isNaN(buy) && !isNaN(used)) {
   	 return jaego.val(buy - used);
    }
}
function f_auto_sum(obj,v1,v2,result) {
    let buy = $(obj).parent().parent().find(v1).val();
    let used = $(obj).parent().parent().find(v2).val();
    let jaego =  $(obj).parent().parent().find(result);

    if(!isNaN(v1) && !isNaN(v2)) {
   	 return result.val(buy - used);
    }
}

 

'JAVASCRIPT' 카테고리의 다른 글

rowspan 된 테이블 안에 같은 값 주기  (0) 2022.04.19
체크박스(checkbox) 클릭 막기  (0) 2022.03.16

disabled 속성을 줘도 되지만, 회색으로 변해서 알아보기도 힘들고 form name 값이 넘어가지 않는 현상이 있었다.

 

 

 

 

<input type="checkbox" onclick="return false;" />

 

를 추가해주었다.

*테이블 조회

SELECT 
    TABLE_SCHEMA,table_name, table_comment
FROM
    information_schema.tables
WHERE
    table_comment like '%%';

 

*칼럼조회

SELECT
    table_name, column_name, column_comment
FROM
    information_schema.columns
WHERE
    column_comment like '%처리량%';

+ Recent posts