问题描述
请仔细阅读此代码。我根本不是JS程序员,但是我不知道为什么在基本相同的上下文中为什么相同的行
在一个地方工作但是在另外,它会导致整个界面消失。
这是一个标签式界面,我只是想传递
$ f $ b在JS fxns中的options_total值。我没有得到错误输出
Javascript控制台...只是一个没有标签,面板或
表格的空白屏幕。
工作代码:用行调用
updateOptionsTotal({$ optionset_id},{$ productoption _id},this.form)
函数updateOptionsTotal(set_id ,new_option_id,form){
former_option_id = selected_options [set_id];
selected_options [set_id] = new_option_id;
options_total = eval(form.options_total.value);
....
打破:(用线路调用:
writeTabPanel(this.form);
函数writeTabPanel(form){
var tpText ='''';
tpText + =''< div id ="'';
tpText + = this.tab.id;
tpText + =''" class =" tab" ; style =" top:'';
tpText + = this.tab.top;
tpText + =''; left:'';
tpText + = this.tab.left;
tpText + =' ;宽度:;
tpText + = this.tab.width;
tpText + =" onClick =" showPanel(\'''';
tpText + = this.tab.id +''\'',\''''+ this.panel.id;
options_total = eval(form.options_total.value);
....
如果我注释掉最后一行,一切都很好 - 除了
之外,该值显然没有通过。
Please give this code a look. I''m not a JS programmer at all, but I
can''t figure out why identical lines in essentially the same context
work in one place but in the other, it causes the entire interface to
disappear.
This is for a tabbed interface, and I''m just trying to pass the
options_total value around among the JS fxns. I get no error output in
the Javascript Console ... just a blank screen without tabs, panels, or
forms.
Working code: called with the line
updateOptionsTotal({$optionset_id},{$productoption _id},this.form)
function updateOptionsTotal(set_id,new_option_id,form) {
former_option_id = selected_options[set_id];
selected_options[set_id] = new_option_id;
options_total=eval(form.options_total.value);
....
Breaking: (called with the line:
writeTabPanel(this.form);
function writeTabPanel(form){
var tpText = '''';
tpText += ''<div id="'';
tpText += this.tab.id;
tpText += ''" class="tab" style="top:'';
tpText += this.tab.top;
tpText += '';left:'';
tpText += this.tab.left;
tpText += '';width:'';
tpText += this.tab.width;
tpText += ''" onClick="showPanel(\'''';
tpText += this.tab.id + ''\'',\'''' + this.panel.id;
options_total = eval(form.options_total.value);
....
If I comment out this last line, everything works great -- except that
the value obviously isn''t passed.
这篇关于流程形式变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!