大佬教程收集整理的这篇文章主要介绍了javascript – Jquery条件语句,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_450_8@var id = $('#sometextfield').val();
该文本字段值是动态生成的,例如.
@H_450_8@<input type="text" name="id" id="id" value="<?PHP echo $_get[something];?>" />)
@H_450_8@if(id == 100 || id ==120) { // i have these variables var mulitiplier = 0.005 var price = (some alog) * mulitiplier; // do some very long piece of code } else if (id == 200 || id == 220) { // Then i have these variables var mulitiplier = 0.090; var price = (some alog) * mulitiplier; // Do the same very long piece of code(its practically the same thing as // the first if statement and the only change is the ariable multiplier) }
这有效,但除此之外没有任何方法可以不重复同样的事情.我不喜欢它的外观.
提前谢谢了..
以上是大佬教程为你收集整理的javascript – Jquery条件语句全部内容,希望文章能够帮你解决javascript – Jquery条件语句所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。