转到 asp 上的下一步:在 div 上单击 aspx (JS) 向导
我在 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("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>
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我发现有两个问题可能会导致您的 javascript 无法运行:
您正在双引号您的 javascript 字符串:您有:
onclick="'javascript:...'"
,它应该是:
或者
另外,您应该不要在 javascript 中使用 " html 实体来表示引号,您应该只使用引号(只需确保您使用的引号与包围整个 javascript 行的引号相反)。
尝试将代码行更改为:
I can see 2 issues which might cause your javascript not to run:
You are double quoting your javascript string: you have:
onclick="'javascript:...'"
and it should be:
or
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:
向导按钮
Next
具有type="submit"
因此,在
WebForm_DoPostBackWithOption
之后的 javascript 代码中,您必须调用document.forms [0].submit();
The wizard button
Next
hastype="submit"
So, in your javascript code after
WebForm_DoPostBackWithOption
, you have to calldocument.forms[0].submit();