简单的基于 jQTouch Form 的产品选择器

发布于 2024-09-28 05:40:39 字数 560 浏览 1 评论 0原文

我正在使用 jQTouch 构建一个简单的移动应用程序,其 html/js/jquery 表单充当产品选择器。它有 5 个下拉菜单和 6 种可能的场景:

场景: 有 6 种产品 - 选择得分最高的产品。然后,用户将被带到包含该产品内容的 div(它充当 jQTouch 中的页面)。

形式:

问题 1

选项 1:产品 A 1 分,产品 C 1.5 分
选项 2:产品 B 1 分,产品 D 1 分
选项 3:产品 C 1 分,产品 E 1 分
选项 4:产品 F 为 1.5 分

- 等等,共 5 个问题。

由于这是使用 jQTouch,我希望通过表格找出哪个产品具有最多点,然后将用户带到相应的 div(页面)。有人对完成这项任务的最佳方法有任何见解吗?

非常感谢所有帮助。 :) 谢谢。

I'm using jQTouch to build a simple mobile app with an html/js/jquery form that which acts as a product selector. It has 5 dropdown menus, and 6 possible scenarios:

Scenarios: There are 6 products - whichever gets the most points is chosen. The user is then taken to the div (which acts as a page in jQTouch) with the content for that product.

Form:

Question 1

Option 1 : 1 point for Product A, 1.5 points for Product C
Option 2 : 1 point for Product B, 1 point for Product D
Option 3 : 1 point for Product C, 1 point for Product E
Option 4 : 1.5 points for Product F

- And so forth, across 5 questions.

As this is using jQTouch, I was hoping to have the form figure out which product had the most points, and then take the user to the appropriate div (page). Would anyone please have any insight to the best method to accomplish this task?

All help is very much appreciated. :) Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

他不在意 2024-10-05 05:40:39

想通了并认为发帖可能对其他人有帮助:) 在 jQTouch + Phonegap 中工作。
在 HTML 中:

        <form name="myForm" action="">
        <p>1. Question 1</p>
            <span>
            <select id="rofy-q1" name="q1" class="btn">
                <option value="0" disabled="disabled">Please select</option>
                <option value="50">Option 1</option>
                <option value="100">Option 2</option>
                <option value="200">Option 3</option>
                <option value="300">Option 4</option>
                <option value="400">Option </option>
            </select>
        </span>
        <p>2. Question 2</p>
            <!-- ETC - fill out the remaining questions as per q1 but change the 'name' to q2, q3 etc. -->
        <span class="buttoncontain"><input href="#" type="button" value="Click to see your results" class="btn" onclick="getProduct();"></span>
        </form>

<script type="text/javascript" charset="utf-8">
        function getProduct() {
            // Get scores - a=answer, q=question
            var a1 = document.myForm.q1.value;
            var a2 = document.myForm.q2.value;
            var a3 = document.myForm.q3.value;
            // Calculate the scores
            var userCalc = parseInt(a1) + parseInt(a2) + parseInt(a3);
            // Suggest a product based on scores
            if (userCalc <= 99) {
                // alert("Product 1");
                jQT.goTo("#p1");
            } else if (userCalc <= 199) {
                // alert("Product 2");
                jQT.goTo("#p2");
            } else {
                // alert("Product 3");
                jQT.goTo("#p3");
            }
            // End functions
        }
        </script>

Figured it out and thought that posting might help someone else :) Working in jQTouch + phonegap.
In HTML:

        <form name="myForm" action="">
        <p>1. Question 1</p>
            <span>
            <select id="rofy-q1" name="q1" class="btn">
                <option value="0" disabled="disabled">Please select</option>
                <option value="50">Option 1</option>
                <option value="100">Option 2</option>
                <option value="200">Option 3</option>
                <option value="300">Option 4</option>
                <option value="400">Option </option>
            </select>
        </span>
        <p>2. Question 2</p>
            <!-- ETC - fill out the remaining questions as per q1 but change the 'name' to q2, q3 etc. -->
        <span class="buttoncontain"><input href="#" type="button" value="Click to see your results" class="btn" onclick="getProduct();"></span>
        </form>

<script type="text/javascript" charset="utf-8">
        function getProduct() {
            // Get scores - a=answer, q=question
            var a1 = document.myForm.q1.value;
            var a2 = document.myForm.q2.value;
            var a3 = document.myForm.q3.value;
            // Calculate the scores
            var userCalc = parseInt(a1) + parseInt(a2) + parseInt(a3);
            // Suggest a product based on scores
            if (userCalc <= 99) {
                // alert("Product 1");
                jQT.goTo("#p1");
            } else if (userCalc <= 199) {
                // alert("Product 2");
                jQT.goTo("#p2");
            } else {
                // alert("Product 3");
                jQT.goTo("#p3");
            }
            // End functions
        }
        </script>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文