使用FormWizard尝试为相关问题创建书签

时间:2012-06-30 14:22:09

标签: jquery formwizard

下午/上午

我正在使用有10个问题的Jquery formwizard

  1. 第一个问题
  2. 第二个问题
  3. 第三个问题 等一直问题10
  4. 我试图在侧面创建一个书签,这样用户可以从问题中来回跳转而不必按下一个/上一个按钮,但是我有一个小问题试图让它工作...... < / p>

    下面是表格向导的布局我没有发布所有10个问题,因为我不想阻止这个页面,但请看下面的3个问题

    <a href="#" id="lnk3" style="color:Black">Go to Question 3</a>
          <div id="feedbackform">
                <fieldset class="sectionwrap" id="Q1">
                    <legend>Question 1</legend>
                    <p>
                        Which one of this five words means the same as <strong>TIRED</strong>? Write the number in the Answer
                        Square.</p>
                    <ol>
                        <li>LATE</li>
                        <li>CLIMB</li>
                        <li>HEAVY</li>
                        <li>WEARY</li>
                        <li>SLOW</li>
                    </ol>
                    <p style="margin-left:-5%">
                        <asp:TextBox ID="Q1Answer" runat="server" class="TextBox" />
                    </p>
                </fieldset>
                <fieldset class="sectionwrap" id="Q2">
                    <legend>Question 2</legend>
                    <p>
                        One of these numbers is wrong, because is does not follow the regular order of the
                        other numbers in the row.<br />
                        <br />
                        Write the number which is wrong in the Answer Square</p>
                    <p style="margin-left: 32%">
                        <strong>2 4 6 8 10 11 14 16</strong>
                    </p>
                    <div class="WhiteSpace">
                    </div>
                    <p style="margin-left: -5%">
                        <asp:TextBox ID="Q2Answer" runat="server" class="TextBox" />
                    </p>
                </fieldset>
                <fieldset class="sectionwrap" id="Q3">
                    <legend>Question 3</legend>
                    <p>
                        LID is related to BOX as CORK is related to......?<br />
                        <br />
                        Write the number of the correct word in the Answer Square.
                    </p>
                    <ol>
                        <li>WATER</li>
                        <li>LIFE BELT</li>
                        <li>BOTTLE</li>
                        <li>TREE</li>
                        <li>FLOAT</li>
                    </ol>
                    <p style="margin-left: -5%">
                        <asp:TextBox ID="Q3Answer" runat="server" class="TextBox" />
                    </p>
                </fieldset>
        </div>
    

    <a href="#" id="lnk3" style="color:Black">Go to Question 3</a> <div id="feedbackform"> <fieldset class="sectionwrap" id="Q1"> <legend>Question 1</legend> <p> Which one of this five words means the same as <strong>TIRED</strong>? Write the number in the Answer Square.</p> <ol> <li>LATE</li> <li>CLIMB</li> <li>HEAVY</li> <li>WEARY</li> <li>SLOW</li> </ol> <p style="margin-left:-5%"> <asp:TextBox ID="Q1Answer" runat="server" class="TextBox" /> </p> </fieldset> <fieldset class="sectionwrap" id="Q2"> <legend>Question 2</legend> <p> One of these numbers is wrong, because is does not follow the regular order of the other numbers in the row.<br /> <br /> Write the number which is wrong in the Answer Square</p> <p style="margin-left: 32%"> <strong>2 4 6 8 10 11 14 16</strong> </p> <div class="WhiteSpace"> </div> <p style="margin-left: -5%"> <asp:TextBox ID="Q2Answer" runat="server" class="TextBox" /> </p> </fieldset> <fieldset class="sectionwrap" id="Q3"> <legend>Question 3</legend> <p> LID is related to BOX as CORK is related to......?<br /> <br /> Write the number of the correct word in the Answer Square. </p> <ol> <li>WATER</li> <li>LIFE BELT</li> <li>BOTTLE</li> <li>TREE</li> <li>FLOAT</li> </ol> <p style="margin-left: -5%"> <asp:TextBox ID="Q3Answer" runat="server" class="TextBox" /> </p> </fieldset> </div>

    正如你所看到的,当用户点击这个我试图让formwizard转到问题3时,我在顶部有一个id为lnk3的href。

    这是我的Jquery,其中我捕获链接的点击

       $("a[ID='lnk3']").live('click', function()
       {
         $('#feedbackform>Fieldset>ID=Q3');
    
        });
    

    但遗憾的是它没有用?请记住,formwizard是一个插件,我确定你已经新尝试创建了一个JSFiddle,但遗憾的是我无法获得它的formwizard插件,你可以在这里看到一个formqizard的例子http://www.dynamicdrive.com/dynamicindex16/formwizard.htm

    任何帮助都将受到高度赞赏

1 个答案:

答案 0 :(得分:0)

元素可以使用他们的ID直接选择,使用on代替不推荐使用的live,您可以尝试使用offsetscrollTop;

$("#lnk3").on('click', function(e){
   e.preventDefault();
   var t = $('#Q3').offset().top;
   $(window).scrollTop(t)
});