如何解决从活动轮播幻灯片中访问iFrame URL GET参数详细信息作为提交按钮上的隐藏输入
当用户在每张幻灯片之间切换时,我有一个标准的HTML轮播,显示不同的iframe。
<iframe src="my_program.PHP?guid=7ceba1e3f9653755d15062c892bd9de75effeac633c56"></iframe>
我坐在轮播外面,想要一个“编辑此幻灯片”按钮,该按钮将当前活动幻灯片(iframe)的指南作为POST的隐藏输入值传递。 (请参见摘要示例)。
<input type="hidden" name="guid" value="iframe GUID value" />
在每张幻灯片上包括“提交”按钮和隐藏的输入都会复制隐藏的字段,并且表单(我相信)仅采用最后一张幻灯片的最后一个值(无论幻灯片是否处于活动状态)
我假设这需要Javascript,并使用“活动”替换表单隐藏输入周围的文本,但是我对Javascript的专业知识不足以了解最佳方法。帮助真的很感激!!!
var slideIndex = 1;
showSlides(slideIndex);
function plusSlides(n) {
showSlides(slideIndex += n);
}
function currentSlide(n) {
showSlides(slideIndex = n);
}
function showSlides(n) {
var i;
var slides = document.getElementsByClassName("mySlides");
var dots = document.getElementsByClassName("dot");
if (n > slides.length) {
slideIndex = 1
}
if (n < 1) {
slideIndex = slides.length
}
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" active","");
}
slides[slideIndex - 1].style.display = "block";
dots[slideIndex - 1].className += " active";
}
* {
Box-sizing: border-Box
}
/* Slideshow container */
.slideshow-container {
max-width: 1000px;
position: relative;
margin: auto;
}
/* Hide the images by default */
.mySlides {
display: none;
}
/* The dots/bullets/indicators */
.dot {
cursor: pointer;
height: 15px;
width: 15px;
margin: 0 2px;
background-color: #bbb;
border-radius: 50%;
display: inline-block;
transition: background-color 0.6s ease;
}
.active,.dot:hover {
background-color: #717171;
}
/* Fading animation */
.fade {
-webkit-animation-name: fade;
-webkit-animation-duration: 1.5s;
animation-name: fade;
animation-duration: 1.5s;
}
@-webkit-keyframes fade {
from {
opacity: .4
}
to {
opacity: 1
}
}
@keyframes fade {
from {
opacity: .4
}
to {
opacity: 1
}
}
<html>
<body>
<!-- Slideshow container -->
<div class="slideshow-container">
<div class="mySlides fade">
<div style="text-align:center">iframe src='my_program.PHP?guid=7ceba1e3f9653755d15062c892bd9de75f2d0babb16a9'</div><br>
<div style='text-align:center'>Slide 1 of 3</div>
</div>
<div class="mySlides fade">
<div style="text-align:center">iframe src='my_program.PHP?guid=7ceba1e3f9653755d15062c892bd9de75f17a8b720bc2'</div><br>
<div style='text-align:center'>Slide 2 of 3</div>
</div>
<div class="mySlides fade">
<div style="text-align:center">iframe src='my_program.PHP?guid=7ceba1e3f9653755d15062c892bd9de75effeac633c56'</div><br>
<div style='text-align:center'>Slide 3 of 3</div>
</div>
</div>
<br>
<!-- The dots/circles -->
<div style="text-align:center">
<span class="dot" onclick="currentSlide(1)"></span>
<span class="dot" onclick="currentSlide(2)"></span>
<span class="dot" onclick="currentSlide(3)"></span>
</div>
<br><br>
<!-- Processing form -->
<form method="post" action="formprocessor.PHP">
<input type='hidden' name="guid" value="iframe GUID value" />
<input type='submit' value="Edit this Slide" style="margin:auto;
display:block;" />
</form>
</body>
</html>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。