ajax脚本onclick警告弹出消息框

时间:2013-04-04 09:06:18

标签: ajax popup alert

我发现这个投票脚本在线,并且想知道而不是onclick警报(你已投票)我可以将它更改为一个弹出消息,我可以用css样式...我只提交了一部分代码,如果你需要看到更多让我知道。提前谢谢

    function addVotData(elm_id, vote, nvotes, renot) {
  // exists elm_id stored in ivotings
  if(ivotings[elm_id]) {
    // sets to add "onclick" for vote up (plus), if renot is 0
    var clik_up = (renot == 0) ? ' onclick="addVote(this, 1)"' : ' onclick="<a type="button" class="btn" style="width:100%;" href="#test_modal" data-toggle="modal">alert</a>"';

    // if vot_plus, add code with <img> 'votplus', else, if vot_updown1/2, add code with <img> 'votup',  'votdown'
    if(ivotings[elm_id].className == 'vot_plus') {    // simple vote
      ivotings[elm_id].innerHTML = '<h6>'+ vote+ '</h6><span><img src="'+votingfiles+'arrow.png" alt="1" title="vote"'+ clik_up+ '/></span>';
    };
}
}

1 个答案:

答案 0 :(得分:1)

您可以使用Bootstrap模式弹出而不是警报。 This is well explained example

如果您需要更多帮助,请告诉我


更新

html for model pop up:

<div class="modal fade" id="test_modal"> <div class="modal-header"> 
<a class="close" data-dismiss="modal">&times;</a> <h3>Modal Header</h3> </div> 
<div class="modal-body"> <p>Test Alert</p> </div> <div class="modal-footer"> 
<a href="#" class="btn" data-dismiss="modal">Close</a> </div> </div>

按钮的HTML

<input type="Button" Text="ShowModal" Id="MyButton"/>

JavaScript的:

$( "#MyButton" ).click(function() {
$('#modalName').modal('show');
 });
相关问题