使用 php 和 javascript/JQuery 按类或 id 检索图像源
我想做的是,我在页面上显示一个图像,另一个图像位于顶部,上面有由以下教程中的 JQuery 实现的许多帧选择:
http://www.queness.com/post/3036/create-a-custom-jquery-image-gallery-with-jcarousel
使用 JCarousel,许多选定的图像之一将被分配“active”类,并且
我想要做的是每当用户单击或选择并传递到 php 时获取具有“活动”状态(类)的图像 src 位置。有人介意提供一些关于我该怎么做的建议或技巧吗?
感谢您花时间阅读我的问题。
What i'm trying to do is i have an image display on the page and another image lays on top with many frames selection implemented by JQuery from the following tutorial:
http://www.queness.com/post/3036/create-a-custom-jquery-image-gallery-with-jcarousel
With JCarousel, one of the images from many selected will be assigned with "active" class to the
<li><a href="#"><img src="#" /></a></li>
What i want to do is to get the image src location with "active" state (class) whenever user click or select and pass into php. Does anyone mind to offer some suggestion or tips on how can i do that?
Thank you for your time reading my Question.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
下面的 jQuery 应该在 JavaScript 中选择您想要的内容:
至于将其传递给 PHP,这取决于您提交信息的方式。您可以通过 HTTP
< 提交src ;form>
POST(其中action
是编码为解析请求的 PHP 文件)或通过 AJAX 请求。您可以在 PHP $_POST< 中访问发布数据/a> 数组。JavaScript
PHP
The following jQuery should select what you want in JavaScript:
As for passing it to PHP, it depends on how you are submitting information. You could submit the src via an HTTP
<form>
POST (where theaction
is the PHP file that is coded to parse the request) or via an AJAX request. You can access the posted data in the PHP $_POST array.JavaScript
PHP