指数反问题? [英] Index Counter Problem?

查看:45
本文介绍了指数反问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好...


i我的表单上有一个选择菜单,有3个选项:


1.快递

2.电子邮件

3.本地接送


我已经加入了onChange在另一个选择菜单上的事件处理程序,用于添加或删除此选择菜单中的第三个选项...


有一个主要功能(切换功能)带触发器2其他功能(添加或删除功能)...现在删除功能工作,但我不能让添加功能工作。我不明白我做错了什么。


这是代码:

展开 | 选择 | Wrap | 行号

解决方案

for(indexCounter = 3; indexCounter> 3; indexCounter--)


indexCounter> 3;这可能永远不会是真的,如果它是= 3,它怎么可能比3好呢?

所以for循环中的任何东西永远不会被执行。


< blockquote class =post_quotes>
for(indexCounter = 3; indexCounter> 3; indexCounter--)


indexCounter> 3;这可能永远不会是真的,如果它是= 3,它怎么能比3好呢?

所以无论在for循环中什么都不会被执行。



那里。是的,我意识到了,但写了indexCounter> 2英寸什么都不工作...并且根据我用来执行这个功能的代码教程,这个确切的短语据说是插入新选项的占位符...所以我需要添加一个选项第3个位置(indexCounter> 3)... ???


这些函数过去对我来说很有用,如果我要删除和添加的选项是在列表中间的某个地方...但是现在我正在努力使选择菜单的最后一个选项与这些功能一起工作...而且,我无法将最后一个选项放入中间使这个功能起作用,因为它会破坏已经写过的其他功能...


所以我想我问我怎么可能写这个功能使其适用于添加/删除列表中最后一个选项的选项?


您的添加代码没有意义。


您是否正在尝试添加或更改它电子文字?如果它已被添加怎么办?你确定你有三个选项 - 选项[3]将是第四项。

你想在for循环中做什么?您是否试图将所有选项移到一个地方?


如果您能提供答案,我认为您的问题很容易解决。


也许此页可能有所帮助。

hi everyone...

i have a select menu on my form with 3 options:

1. Courier
2. Email
3. Local Pick-Up

i''ve included an "onChange" event handler on a different select menu to add or remove the 3rd option from this select menu...

there is one main function (Toggle Function) with triggers 2 other functions (either Add or Remove functions)... right now the Remove function works, but i can''t get the Add function to work. i don''t understand what i''m doing wrong.

this is the code:

Expand|Select|Wrap|Line Numbers

解决方案

for (indexCounter = 3;indexCounter > 3; indexCounter--)

indexCounter > 3 ; this could never be true, if it is =3, how could it be great than 3?
So whatever in the for loop never get executed.


for (indexCounter = 3;indexCounter > 3; indexCounter--)

indexCounter > 3 ; this could never be true, if it is =3, how could it be great than 3?
So whatever in the for loop never get executed.

hi there. yes i realized that, but writing "indexCounter > 2" doesn''t work either... and based on the code tutorial i use to execute this function, this exact phrase is said to be the place holder for the new option to be inserted...so i need to add an option in the 3rd position ("indexCounter > 3")... ???

these functions have worked great for me in the past if the select option i am removing and adding is somewhere in the middle of a list... but now i''m having a very difficult time trying to make the last option of the select menu work with these functions... also, i am unable to just place the last option in the middle to make this function work, as it would ruin other functions that have been already written...

so i guess i''m asking how is it possible to write this function to make it work for adding/removing a select option that is the last option in the list?


Your add code does not make sense.

Are you trying to add or also change the text? What if it has already been added? Are you sure you have three options - options[3] would be the 4th item.
What are you trying to do in the for loop? Are you trying to move all the options up one place?

If you can provide answers, I think your problem is easy to solve.

Perhaps this page might help.


这篇关于指数反问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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