更改页面加载时的按钮值 [英] change button value on page load

查看:93
本文介绍了更改页面加载时的按钮值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

< table border =0align =center> 
< tr>
< td align =right>
< input id =PXP_SUN_GET_IMPACT_ANALYSIStype =buttonvalue =生成影响分析问卷
style =width:366px; margin-left:0pxönclick=DisplayApprQuestions(); />
< / td>


< / tr>
< / table>


函数OnMOCPageLoad(){
var GenQues = document.getElementById(PXP_SUN_GET_IMPACT_ANALYSIS);
GenQuesBtn(GenQues,lang);

}

函数GenQuesBtn(btn,lang){
if(lang.toLowerCase()==de-de){
document .form.GenQues.value =dsfsdf;
}
}



需要将按钮值更改为dsdsds,而页面加载时语言为chnage to chnage。

i已经写了上面的代码但没有工作。



给出以下的错误:

消息:'document.form.GenQues '是null或不是对象





请提前帮助thx

解决方案

< blockquote>试试这个:

  function  OnMOCPageLoad(){
var GenQues = document .getElementById( PXP_SUN_GET_IMPACT_ANALYSIS);
GenQuesBtn(GenQues,lang);

}

function GenQuesBtn(btn,lang){
if (lang.toLowerCase()=== de-de ){
btn.value = 你的价值;
}
}





您已经通过函数参数传递了按钮,因此您可以在此处使用它方式。

<table border="0" align="center">
             <tr > 
                                    <td align="right">
                        <input id="PXP_SUN_GET_IMPACT_ANALYSIS" type="button" value="Generate Impact Analysis Questionaire"
                            style="width: 366px; margin-left: 0px"  önclick="DisplayApprQuestions();"  />
                    </td>

                
                </tr>
            </table>


function OnMOCPageLoad() {
 var GenQues = document.getElementById("PXP_SUN_GET_IMPACT_ANALYSIS");
 GenQuesBtn(GenQues, lang);

}

 function GenQuesBtn(btn, lang) {
        if (lang.toLowerCase() == "de-de") {
            document.form.GenQues.value = "dsfsdf"; 
        }
    }


need to change button value to dsdsds while language is chnage to german on page load.
i have write above code but not working.

give below eror:

Message: 'document.form.GenQues' is null or not an object



pls help thx in advance

解决方案

Try this:

function OnMOCPageLoad() {
 var GenQues = document.getElementById("PXP_SUN_GET_IMPACT_ANALYSIS");
 GenQuesBtn(GenQues, lang);

}

function GenQuesBtn(btn, lang) {
  if (lang.toLowerCase() === "de-de") {
      btn.value = "Your value";
  }
}



You've passed your button through the function parameter so you can use it in this way.


这篇关于更改页面加载时的按钮值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆