转到 asp 上的下一步:在 div 上单击 aspx (JS) 向导

发布于 2024-08-03 08:51:39 字数 2328 浏览 4 评论 0原文

我在 aspx 页面上有一个 div,在其中创建了 onClick 事件。 div 的 onClick 指向:

onclick="'javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentPlaceHolder1$Wizard1$StepNavigationTemplateContainerID$StepNextButton", "", true, "", "", false, false))'"

上面的链接恰好是页面上 StepNext 按钮的 onClick。我已经删除了该按钮的可见性,因此希望允许它,以便当我单击此 div 时它会转到下一步。

然而,这不起作用吗?浏览器什么也不做。 有没有办法从 aspx 页面转到下一步?

编辑:这是一些附加代码:

div(注意:我尝试使用其下面的代码的确切onClick,但也不起作用):

            <div id="Box1" class="BoxUploadStyle"  onmouseover="this.style.backgroundImage='url(../IMG/box1_over.gif)';this.style.cursor='hand';this.style.cursor='pointer';" 
                onmouseout="this.style.backgroundImage='url(../IMG/box1.gif)';" 
                onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions('Box1', '', true, '', '', false, false))">  
            <h3><a href="#">Simple Upload</a></h3> 
            Upload upto 10 files each time.
            </div>

这是按钮“下一步”和“上一个”的代码(从查看源代码 - 因为它是向导的一部分):

</tr><tr>
        <td align="right">
            <input type="submit" name="ctl00$ContentPlaceHolder1$Wizard1$StepNavigationTemplateContainerID$StepPreviousButton" value="Previous" id="ctl00_ContentPlaceHolder1_Wizard1_StepNavigationTemplateContainerID_StepPreviousButton" style="color:#284E98;background-color:White;border-color:#507CD1;border-width:1px;border-style:Solid;font-family:Verdana;font-size:0.8em;" />
            <input type="submit" name="ctl00$ContentPlaceHolder1$Wizard1$StepNavigationTemplateContainerID$StepNextButton" value="Next" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl00$ContentPlaceHolder1$Wizard1$StepNavigationTemplateContainerID$StepNextButton&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" id="ctl00_ContentPlaceHolder1_Wizard1_StepNavigationTemplateContainerID_StepNextButton" style="color:#284E98;background-color:White;border-color:#507CD1;border-width:1px;border-style:Solid;font-family:Verdana;font-size:0.8em;" />
        </td>

I have a div on the aspx page in which I have created an onClick event.
The onClick for the div points to:

onclick="'javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentPlaceHolder1$Wizard1$StepNavigationTemplateContainerID$StepNextButton", "", true, "", "", false, false))'"

The above link so happens to be the onClick for the StepNext button on the page. I have removed that button's visibility, and hence want to permit it so that when I click on this div it would goto the next step.

However, it doesn't work? The browser does nothing.
Is there a way I can goto the next step from the aspx page?

EDIT: Here is some additional code:

The div (note: I tried with the exact onClick of the code below it, and does not work either):

            <div id="Box1" class="BoxUploadStyle"  onmouseover="this.style.backgroundImage='url(../IMG/box1_over.gif)';this.style.cursor='hand';this.style.cursor='pointer';" 
                onmouseout="this.style.backgroundImage='url(../IMG/box1.gif)';" 
                onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions('Box1', '', true, '', '', false, false))">  
            <h3><a href="#">Simple Upload</a></h3> 
            Upload upto 10 files each time.
            </div>

Here is the code for the button Next and Previous (from the View Source - since it is part of the wizard):

</tr><tr>
        <td align="right">
            <input type="submit" name="ctl00$ContentPlaceHolder1$Wizard1$StepNavigationTemplateContainerID$StepPreviousButton" value="Previous" id="ctl00_ContentPlaceHolder1_Wizard1_StepNavigationTemplateContainerID_StepPreviousButton" style="color:#284E98;background-color:White;border-color:#507CD1;border-width:1px;border-style:Solid;font-family:Verdana;font-size:0.8em;" />
            <input type="submit" name="ctl00$ContentPlaceHolder1$Wizard1$StepNavigationTemplateContainerID$StepNextButton" value="Next" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentPlaceHolder1$Wizard1$StepNavigationTemplateContainerID$StepNextButton", "", true, "", "", false, false))" id="ctl00_ContentPlaceHolder1_Wizard1_StepNavigationTemplateContainerID_StepNextButton" style="color:#284E98;background-color:White;border-color:#507CD1;border-width:1px;border-style:Solid;font-family:Verdana;font-size:0.8em;" />
        </td>

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

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

发布评论

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

评论(2

清旖 2024-08-10 08:51:39

我发现有两个问题可能会导致您的 javascript 无法运行:

  1. 您正在双引号您的 javascript 字符串:您有:

    onclick="'javascript:...'"

,它应该是:

onclick="javascript:..."

或者

onclick='javascript:...'

另外,您应该不要在 javascript 中使用 " html 实体来表示引号,您应该只使用引号(只需确保您使用的引号与包围整个 javascript 行的引号相反)。

尝试将代码行更改为:

onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions('ctl00$ContentPlaceHolder1$Wizard1$StepNavigationTemplateContainerID$StepNextButton', '', true, '', '', false, false))"

I can see 2 issues which might cause your javascript not to run:

  1. You are double quoting your javascript string: you have:

    onclick="'javascript:...'"

and it should be:

onclick="javascript:..."

or

onclick='javascript:...'

Also, you shouldn't use the " html entity in javascript to indicate a quote, you should just use quotes (just make sure you use the opposite of the one you use to surround the entire javascript line).

try changing your code line to this:

onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions('ctl00$ContentPlaceHolder1$Wizard1$StepNavigationTemplateContainerID$StepNextButton', '', true, '', '', false, false))"
裸钻 2024-08-10 08:51:39

向导按钮 Next 具有 type="submit"

因此,在 WebForm_DoPostBackWithOption 之后的 javascript 代码中,您必须调用 document.forms [0].submit();

The wizard button Next has type="submit"

So, in your javascript code after WebForm_DoPostBackWithOption, you have to call document.forms[0].submit();

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文