Javascript jQuery 调查中所需的项目
我正在构建一个多问题调查,其中使用 javascript 来:
确保页面上显示的所有调查问题都得到解答
显示基于前一项的答案在页面上显示附加问题。
1 和 2 似乎都可以在我测试过的 90% 的浏览器和操作系统中运行。当它不起作用时,我看不到任何一致性。
示例:https://ssl.bullysurvey.com/QUESTIONS/m_survey/02.html
如果为项目 1a 选择“是”响应,您将看到出现 1b。然后,在进入下一页之前,这两个项目都应该需要响应。当 1a 选择“是”时,文件“02_table_2.html”将被加载并插入到 1a 下方。
问题在于,大约 10% 的情况下,当为 1a 选择“是”时,1b 并不总是出现,或者即使出现,也不需要对 1b 进行响应。当我在数据库中收集到 1a 的“是”响应时,我应该始终收到 1b 的响应。情况并非总是如此,这是一个问题。在这些罕见的情况下,我不认为 JavaScript 代码始终有效。也许当问题出现时,页面尚未完全加载,或者还有一些我不知道的其他故障。
如果有人能看一下这个,我将不胜感激。您发现我的编码有问题吗?有更好的方法吗?
非常感谢,
迈克
I'm building a multi-question survey where I'm using javascript to:
make sure all survey questions displayed on a page are answered
show an additional question on a page based on the answer to a previous item.
Both 1 and 2 seem to be working in 90% of the browsers and operating systems I've tested this with. I'm not seeing any consistency when it doesn't work.
Example: https://ssl.bullysurvey.com/QUESTIONS/m_survey/02.html
If the 'Yes' response is selected for item 1a, you'll see 1b appear. Both items should then require a response before proceeding to the next page. When 'Yes' for 1a is selected the file '02_table_2.html' is loaded and inserted below 1a.
The problem is that about 10% of the time when 'Yes' is selected for 1a, 1b doesn't always appear or if it does, a response is not required for 1b. When I collect a 'Yes' response for 1a in my database, I should always have a response for 1b. This is not always the case and it's a problem. In these rare cases, I don't think the javascript code is working all the time. Maybe when the problem appears the pages have not loaded completely or there's some other glitch I'm not aware of.
I'd appreciate it if someone could look this over. Do you see a problem with my coding? Is there a better way to do this?
Thanks so much,
Mike
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的代码相当草率。例如,您正在加载 jQuery 1.5 和 jQuery 1.3
此外,还有许多库和自定义脚本 - 这是相当混乱的。
第一步取出重复的冲突库,然后尝试组织您的代码,我相信您将能够找到错误。
You code is quite sloppy. For example you are loading both jQuery 1.5 and jQuery 1.3
In addition there are MANY libraries and custom scripts -- it is quite confusing.
Take out the duplicate conflicting library as a first step and then try an organize your code, I'm sure you will be able to find the bugs then.