【问题标题】:confirmation dialog box in rjsrjs 中的确认对话框
【发布时间】:2012-07-30 09:58:19
【问题描述】:

我的 rjs 模板中有以下代码,它显示一个确认框:

page << "r = confirm('Would you like to link this newly created author to the book?')"

我试过了

`page << "if r == true {"`   
 #do action a
`page << "} else {"`  
 #do action b
`page << "}"`

上面的代码不正确。

我的问题是如何获得确认框中所做选择的值(真或假)?

非常感谢。

【问题讨论】:

    标签: ruby-on-rails rjs


    【解决方案1】:

    试试这个语法:

    page << "var r = confirm('Would you like to link this newly created author to the book?');"
    
    page << "if (r == true) {" 
      #do action a
    page << "} else {"
      #do action b
    page << "}"
    

    我试过了,它似乎有效。

    【讨论】:

      猜你喜欢
      • 2016-05-31
      • 1970-01-01
      • 1970-01-01
      • 2012-08-27
      • 2011-05-24
      • 2016-02-02
      • 2023-04-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多