问题描述
我试图从asp.net Web表单上的单选按钮onclick事件中打开Shadowbox,但没有成功.我最初使用单击按钮打开它,效果很好,但是现在需要确保在选择单选按钮选项时它会发生.然后,我尝试单击javascript(button.click())中的按钮,但这仅在IE和较新版本的firefox中有效.因此,我选择使用Shadowbox.open,但这会引起一些问题.这是我的代码:
I'm trying to open Shadowbox from within a radio button onclick event on a asp.net web form without success. I was initially opening it using a button click which worked fine, but now need to make sure it happens when the radio button option is selected. I then tried to click the button in javascript (button.click()), but that only worked in IE and Newer versions of firefox. So I have opted to use Shadowbox.open, but it is causing some issues. Here is my code:
if (yes.checked == true)
{
var url = 'http://localhost:52963/items.aspx';
Shadowbox.open( { content: url,
type: "iframe",
title: "sbTitle ",
options: { initialHeight:350,
initialWidth:450,
loadingImage:"loading.gif",
handleUnsupported: 'link'
}
});
}
这似乎只是打开了叠加层,但没有打开其中的网页.有人知道我要去哪里了吗?
This just seems to bring up the overlay but doesn't open the web page inside it. Anyone know where I'm going wrong?
推荐答案
显然,我需要添加一个播放器以及一个类型.所以修改后的代码是这样的:
Apparently I needed to add a player as well as a type. So the amended code is this:
Shadowbox.open( { content: url,
type: "iframe",
player: "iframe",
title: "sbTitle ",
options: { initialHeight:350,
initialWidth:450,
loadingImage:"loading.gif",
handleUnsupported: 'link'
}
});
这篇关于从JavaScript函数打开Shadowbox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!