需要将php值传递给javascript

时间:2012-12-21 08:47:26

标签: php javascript

  

可能重复:
  How to pass JavaScript variables to PHP?

以下是我的代码:

function disablefields(){ 

var suresh=[<?php echo $cryo_1kl_18_orig_jan; ?>];

if (document.getElementById('checkboxA').checked == 1){

document.getElementById('cryo_1kl_18_rev_jan').disabled=''; 
document.getElementById('cryo_1kl_18_rev_jan').value='**i want pass the php value here**';

}

我想将php值传递给javascript ...

2 个答案:

答案 0 :(得分:0)

function disablefields()
{ 
     var suresh=[<?php //echo $cryo_1kl_18_orig_jan; ?>];

    if (document.getElementById('checkboxA').checked == 1) {
        document.getElementById('cryo_1kl_18_rev_jan').disabled=''; 
        document.getElementById('cryo_1kl_18_rev_jan').value='<?=$your_value?>';
    }

答案 1 :(得分:0)

document.getElementById('cryo_1kl_18_rev_jan').value='<?php echo $php_value;?>';