-1
私は、javascript関数に応じて可視性が設定された複数のdivを持つウィンドウを持っています。 今、javascript関数を呼び出して、そのウィンドウ内の可視divがtelerikウィンドウのcloseイベントで隠されるようにしたいとします。つまり、実行時にwindow oncloseイベントでvisibility = visibleと表示されたdivのIDを渡す必要があります。mvcでのイベントのjavascript
どうすればよいですか?このよう
function opendivinwindow(thediv) {
var div = document.getElementById(thediv);
div.style.visibility = "visible";
var window = $("#Window").data("tWindow");
window.center().open();
}
function Onclose() {
var div = document.getElementById('resumetitle');
div.style.visibility = "hidden";
}
ビュー
<% using (Html.BeginForm("Resumename", "resumewizard", FormMethod.Post, new { name = "Resumetitle",OnLoad="Error();"}))
{%>
<%=Html.Label("Step 1.Resume Name")%><br />
<%=Html.Label("Please Enter Resume Name,Job Title and Objective")%><br />
<%=Html.Label("Resume Name")%><br />
<%=Html.TextBox("ResTitle")%><a href="javascript:opendivinwindow('resumetitle');">
<img src= "../../Content/img/module/QuestionMark.gif" /></a><br />
<%-- <div id="resumetitle" style="visibility:hidden">Resume title</div>--%>
<%=Html.Label("Desired Job Title/Position")%><br />
<%=Html.TextBox("DesPos")%><a href="javascript:opendivinwindow('desiredposition');">
<img src= "../../Content/img/module/QuestionMark.gif" /></a><br />
<%=Html.Label("Objective")%><br />
<%=Html.TextArea("ResObjective")%>
<a href="javascript:opendivinwindow('desiredobjective');">
<img src= "../../Content/img/module/QuestionMark.gif" /></a>
<br />
<% string str = ViewData["Errormsg"].ToString();
%>
<div id="msgblock">
<%=Html.Label(str)%>
<%=Html.Hidden("error", ViewData["Errormsg"])%>
<%=Html.Hidden("resumeid",ViewData["resumeid"])%>
</div>
<input id="SaveForwardButton1" type="image" src="../../Content/img/buttons/SaveForwardButton.gif" onclick="return validation();" />
<% Html.Telerik().Window()
.Name("Window")
.Title("Telerik Window for ASP.NET MVC")
.Resizable(resizing => resizing
.MinHeight(250)
.MinWidth(250)
.MaxHeight(500)
.MaxWidth(500)
)
.Buttons(b => b.Maximize().Close())
.Content(() =>
{%>
<div id="resumetitle" style="visibility:hidden">Resume Name: (will NOT display to employers - max. 50 characters)
- The Resume Name will NOT display to employers. It is for your personal use, to help you identify each unique resume. You can store up to 5 resumes.</div>
<div id="desiredposition" style="visibility:hidden">The Desired Job Title will appear at the top of your resume directly under the contact information heading and will be the first item potential employers see.
Use this field to state your desired Job Title or describe the type of position you are seeking.</div>
<div id="desiredobjective" style="visibility:hidden">Enter the objective of your career move. This is a good opportunity to tell would-be employers what you are all about. Entering specific information regarding your specific history increases the visibility potential of your resume.</div>
<%})
.Width(300)
.Height(300)
.Visible(false)
.ClientEvents(events => events.OnClose("Onclose"))
.Render();
%>
<% }%>
はどのような問題ですか? –
私はdiv idを渡さなければなりませんoncloseそのウィンドウはvisibiltyがtrueであるウィンドウのイベントですこれを行うにはどうすればいいですか? – iProgrammer
jQueryも使いそうですか? $( "#Window")が表示されます。もしそうなら、それを一貫して使用してみませんか? [jQueryで何かが隠されているかどうかをテストする方法](http://stackoverflow.com/questions/178325/how-do-you-test-if-something-is-hidden-in-jquery) – mplungjan