![](/img/trans.png)
[英]How to get Textbox value to a php variable within same php file with a button click (without submitting the form)?
[英]how to get value into textbox without button click
正在使用如下
<input type="text" value="<?php echo empty($this->session->store['actual_info']['actual_total_marketing_budget']) ? '' : $this->session->store['actual_info']['actual_total_marketing_budget']; ?>" readonly name="actual_total_marketing_budget" readonly id="actual_total_marketing_budget" size="30" style="height:20px; " onFocus="total_marketing_budget()"/></td>
在這里,單擊文本框時的問題僅是獲取或更改值,而無需單擊文本框就需要該值。 有人幫我
你可以這樣做
<input type ="text" value="...." id ="actual_total_marketing_budget">
<script type="text/javascript">
function actual_total_marketing_budget(){
var textbox = document.getElementById('actual_total_marketing_budget');
//the function body is the same as you have defined sue the textbox object to set the value
}
actual_total_marketing_budget();
</script>
在這里請注意,我在定義了函數后調用了actual_total_marketing_budget()
函數,該函數在頁面加載后會更改文本框的值。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.