Javascript 在日历中单击日期时如何更改iframe src?
当我在Javascript 在日历中单击日期时如何更改iframe src?,javascript,php,jquery,popup-balloons,Javascript,Php,Jquery,Popup Balloons,当我在我的日历中单击日期时,我使用jquery气球显示iframe 这是的链接 我想通过iframe中的url获取已单击的date和send 所以我可以使用$\u GET 但是我有很多困难 这是我的代码: <script type="text/javascript"> var shown = true; $(function() { $.balloon.defaults.classname = "my-balloon"; $.balloon.defaults.css
我的日历
中单击日期
时,我使用jquery气球
显示iframe
这是的链接 我想通过
iframe
中的url
获取已单击的date
和send
所以我可以使用$\u GET
但是我有很多困难
这是我的
代码
:
<script type="text/javascript">
var shown = true;
$(function() {
$.balloon.defaults.classname = "my-balloon";
$.balloon.defaults.css = null;
$('.date').on("click", function() {
if (shown) {
$('.date').hideBalloon();
$(this).showBalloon();
// Get text from what I click and used it in iframe src
document.getElementById('iframe-date').src += '&date=' + $(this).text()
shown = false;
} else {
$('.date').hideBalloon();
shown = true;
}
}).showBalloon({
//iframe is on contents
contents: '<div style="text-align:right">'
+ '<img style="width:15px" onclick="closeBalloon()" src="<?php echo get_uri('public/images/icon-error.png') ?>">'
+ '</div>'
+ '<iframe id="iframe-date" scrolling="no" seamless="seamless" src="<?php echo get_uri('admin/room/iframeDate/?id=' . $id) ?>"><p>Your browser does not support iframes.</p></iframe>'
});
$('.date').hideBalloon();
});
function closeBalloon()
{
$('.date').hideBalloon();
shown = true;
}
</script>
显示的var=真;
$(函数(){
$.balloon.defaults.classname=“我的气球”;
$.balloon.defaults.css=null;
$('.date')。在(“单击”,函数()上){
如图所示{
$('.date').hideBalloon();
$(this.showBalloon();
//从我单击的内容中获取文本,并在iframe src中使用它
document.getElementById('iframe-date').src+='&date='+$(this.text())
显示=假;
}否则{
$('.date').hideBalloon();
显示=正确;
}
}).展示气球({
//iframe在目录上
内容:“”
+ '">'
+ ''
+'您正在将showballoon内容中的iframe date
定义为字符串。它在dome中不存在。我认为这就是问题所在。那么我该怎么办?还有其他方法吗?因为我需要发送我单击的内容的数据。请尝试创建您的代码的链接,并在您的问题中提供链接。