English 中文(简体)
利用焦炭(具有参数的频率方言)改变碎块的内容
原标题:Change the content of a div using Jquery (Jquery dialog with parameters)

I m从事一项工作。 NET网站(MVC3,但对于我的问题并不真正重要)

我的网页上有一些链接,用户点击了我想开一个Jquery Modal Dialog的链接:

http://jqueryui.com/demos/dialog/#pl-message

对于每个环节,我需要不同的方言。

我的理解是,我不得不在我的网页上具体说明方言的内容。 例如:

<div id="dialog" title="Basic dialog">
    <p>Here we put the content of the dialog</p>
</div>

Links are generated dynamically and I do not want to create a div for each link. also the content of the dialog depends on parameters send by the link

我将努力解释我想要的东西。

我想尽可能做以下工作:

页: 1

<div id="dialog" title="Basic dialog">
</div>

当用户点击链接1时,一个功能称为ShowDialog(FirstName1, LastName1)

该功能将添加以下参数:div“dialog”并开放方言。

当用户在链接2上点击时,“方言”被清除,新内容由<代码>ShowDialog(FirstName2, LastName2)填满,方言被打开。

所有这一切都应当是Jquery或Javascript。

我希望我很清楚。 如果需要更多信息,请询问。

最佳回答

页: 1 • 联系的特性,如:

<a href="#" data-firstname="Foo" data-surname="Bar">Click me</a>
$("#dialog").dialog({ /* settings */ });

$("#link2").click(function() {
    var $el = $(this);
    var fn = $el.data("firstname");
    var sn = $el.data("surname");
    ShowDialog(fn, sn);
});

function ShowDialog(firstname, surname) {
    // Here you can do whatever is required to the dialog, create elements, change text, go nuts.
    $("p", "#dialog").text("Hello " + firstname + " " + surname); 

    // Show the dialog
    $("#dialog").dialog( open );
}
问题回答

暂无回答




相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签