按下提交按钮后如何保持当前幻灯片的显示 [javascript slider]
情况:
我有一个使用 javascript 滑块的网页 [来自 scriptiny dot com 的小滑块]。
我在最后一张幻灯片上使用 jquery 验证和 php 验证创建了一个联系表单。
一切正常,除了:
单击“提交”后,网页将显示第一张幻灯片。
不确定是否热使其粘在接触“滑块”上。
站点导航是使用如下字符串完成的:
onclick="slideshow.pos(0)
onclick="slideshow.pos(1)
onclick="slideshow.pos(2)
onclick="slideshow.pos(3)
onclick="slideshow.pos(4)
我需要联系人“slide”保留在“slideshow.pos(4)”上。
代码:
//If there is no error, send the email
if(!isset($hasError)){
$emailTo = '[email protected]'; //Put your own email address here
$body = "Name: $name \n\nEmail: $email \n\nSubject: $subject \n\nComments:\n $comments";
$headers = 'From: My Site <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;
mail($emailTo, $subject, $body, $headers);
$emailSent = true;
}
我该怎么做?理想情况下,我能够在发送电子邮件后运行一些 JavaScript,使页面刷新将用户发送到“slideshow.pos(4)”??
任何帮助将不胜感激,
马克
Situation:
I have a webpage utilzing a javascript slider [tiny slider from scriptiny dot com].
I created a contact form on the last slide with jquery validation and php validation.
Everything works fine EXCEPT for:
After clicking on Submit, the webpage displays the first slide.
Not sure hot to make it stick to the contact "slide".
Site navigation is done using a string like:
onclick="slideshow.pos(0)
onclick="slideshow.pos(1)
onclick="slideshow.pos(2)
onclick="slideshow.pos(3)
onclick="slideshow.pos(4)
I need the contact "slide" to stay on "slideshow.pos(4)".
Code:
//If there is no error, send the email
if(!isset($hasError)){
$emailTo = '[email protected]'; //Put your own email address here
$body = "Name: $name \n\nEmail: $email \n\nSubject: $subject \n\nComments:\n $comments";
$headers = 'From: My Site <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;
mail($emailTo, $subject, $body, $headers);
$emailSent = true;
}
How can I do this? Ideally, I would be able to run some javascript after the email is sent making the refresh of the page send the user to "slideshow.pos(4)"??
Any help would be appreciated,
Mark
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过 Ajax 调用“提交”数据,并首先避免页面刷新。如果您从未使用过 Ajax,请花一些时间查看 https://developer.mozilla.org/en/ajax< /a>.
You can "submit" your data with an Ajax call and avoid the page from refreshing in the first place. If you never used Ajax take some time to look at https://developer.mozilla.org/en/ajax.