当前位置: 动力学知识库 > 问答 > 编程问答 >

jquery - jqueryui frame dialog and multiple buttons

问题描述:

Here is what I have..I am using the jquery.FrameDialog plugin. When the dialog box opens up, there are 2 buttons. One for let's say open google.com and second button to open stackoverflow.com

Problem is that the default url works fine, but using the button like this: $dialog.load("http://www.google.com"); it doesn't work. What am I doing wrong?

Here is my full code:

 $('#mydialog').click(function(){

var $dialog = jQuery.FrameDialog.create({

url: 'http://www.yahoo.com',

loadingClass: 'loading-image',

title: 'IP Tracing',

width: 1100,

height: 700,

autoOpen: false,

overlay: {

opacity: 0.5,

background: "black"

},

buttons: {

"google": function() {

$dialog.load("http://www.google.com");

},

"stackoverflow": function() {

$dialog.load("http://www.stackoverflow.com");

},

"Exit": function() {

$( this ).dialog( "close" );

}

}

});

$dialog.dialog('open');

return false;

});

网友答案:

maybe there is special and comfortable interface for changing urls for this plugin, but you can always lead your code to do what you want.

$('#box').click(function(){
          var $dialog = jQuery.FrameDialog.create({
          url: 'http://www.yahoo.com',
          loadingClass: 'loading-image',
          title: 'IP Tracing',
          width: 1100,
          height: 700,
          autoOpen: false,
          overlay: {
          opacity: 0.5,
          background: "black"
          },
          buttons: [
                 {
                     text: 'google',
                     click: function() {
                            $(this).find('iframe').attr('src', "http://www.google.com")
                     }
                 },
                 {
                     text: 'Exit',
                     click: function() {
                            $(this).dialog( "close" );
                     }
                 }
          ]
     });

You can simply find an iframe and say this directly to change the url

分享给朋友:
您可能感兴趣的文章:
随机阅读: