peepcode:01.rjs

xiaoxiao2026-08-30  16

peepcode   01.rjs的使用 (1)link_to_remote和link_to_function的区别 link_to_remote为向服务器发出请求,然后生成alert("hello") link_to_function 获得包含这个链接的页面时,就已经生产alert("hello"),不用去服务服务器,会快点. (2)调用helper的方法: page.hello_from_the_helper (3)延迟 page.delay(3.0) do ... end (4)效果 :page.viual_effect :highlight,@task.dom_id,:startcolor=>"'#ff00000'" (5)插入标签:     page.insert_html :bottom,'tasks',:partial=>'task',:locals=>{:task=>@task} (6)表单重置: page['task_form'].reset (7)调用public/javascript的js文件的函数: page.call "set_class_name" (8)删除标签: page.remove @task.dom_id (9)选择标签: (10)动态调用方法: page.send actioin_name (11)替换标签: page.replace 'task_totals',"<h1>hello</h1>" (12)替换标签里面的内容: page.replace 'task_totals',@task_totals. (13)渲染局部模板: page << render(:partial=>"totals") (14)插入js代码: page << %(alert("hello")) (15)分配变量,使firebug可以直接访问: page.assign 'task_totals',@task_totals. (16)弹出提示框: page.alert "hello" (17)js直接写在actions中:
转载请注明原文地址: https://www.6miu.com/read-5052129.html

最新回复(0)