如果用户点击图片,我希望同时触发点击指定的iFrame。那可能吗?图像和iFrame位于同一页面上。如果是这样,你能告诉我可以工作的代码吗?jQuery触发一个iFrame的点击?
这是我到目前为止有:
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
</head>
<body>
<img id="image" src="https://www.google.com/images/srpr/logo4w.png">
<iframe id="iframe" src="http://www.test.com" height= "100" width="160"></iframe>
<script>
jQuery("input.image").click(function(){
$("#iframe").click()
});
</script>
</body>
</html>
它的更好,你尽力去做,然后如果你发现一个问题后代码解决它在一起:) – Somar
好吧,我刚刚更新了我的原始问题与我到目前为止的代码。 – user2453693