클래스 요소를 클릭하면 jQuery 팝업이 열리는 스크립트 블록을 등록했습니다. 스크립트가 완전히 등록되었지만 클래스 요소를 클릭하는 동안 팝업이 열리지 않습니다.
아래 코드는 C #으로 등록 된 스크립트이며 my_modal_open
클래스 를 클릭하면 팝업을 호출하고 싶습니다.
public void RegisterScript()
{
string script = @"function DownloadFiles() {alert('fds');
$('#my_modal').width('auto');
$('#my_modal').popup({
'autoopen': true,
'reposition': true,
'autozindex': true
});
return false;
}
$(document).ready(function () {
$('.my_modal_open').click(function () {
$('#my_modal').popup({
'autoopen': true,
'reposition': false,
'autozindex': true
});
});
});
";
//ScriptManager.RegisterStartupScript(this, this.GetType(), "RegisterClientScriptBlock", script, true);
this.Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "RegisterClientScriptBlock", script, true);
}
아래는 iframe에서 열린 팝업의 HTML 형식입니다.
<div id="my_modal" class="well" style="display: none; width: auto; z-index: 1000;">
<a href="#" class="my_modal_close" style="float: right; padding: 0 0.4em;">×</a>
<iframe name="frDownloadFiles" runat="server" id="frDownloadFiles" src="about:blank"
frameborder="0" width="auto" scrolling="no" style="min-height: 300px;"></iframe>
</div>
아래 코드는 함수를 호출하고 팝업 창 형식을 설정하는 것입니다.
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
BindControl();
frDownloadFiles.Attributes.Add("src", "../DownloadDataPackFiles.aspx?DataPackageID=" + CurrentDataPackages.Id.ToString());
RegisterScript();
}
}
ScriptManager.RegisterStartupScript(this, this.GetType(), "RegisterClientScriptBlock", script, true);
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다