How to set onSuccess event listener for Grails

Grails inherently supports ajax function, such as remoteFunction, remoteLink, etc.
But do you know how to set onSuccess event listener appropriately?
Let me tell you
<input type=”text” id=”name” name=”name” value=””/>
<input type=”button” name=”checkbizname” value=”Chek whether this name already exists” onclick=”${remoteFunction(controller:’mycontroller’,action:’isNameExists’,onSuccess:’popwin(o)’, params:’\’name=\’ + document.getElementById(\’name\’).value’)}”/>
In the above code, when ajax request is handled and get response from server, onSuccess [...]

By javafuns on May 21, 2009 at 22:11 · Views: 2,082 · Permalink · Leave a comment
Categorized in: Scripts · Tagged with: , , ,

Grails RichUI plugin

Rich UI 是一个 AJAx 插件, 可以干很多事情:

#Accordion
#AutoComplete
#CalendarDayView
#CalendarMonthView
#CalendarWeekView
#Carousel
#CheckedTreeView
#DateChooser
#Flow
#Font (creates images dynamically)
#Map
#Portlet
#Redirect
#ReflectionImage
#RichTextEditor
#Star rating
#TabView
#TagCloud
#Timeline
#Tooltip
#TreeView

我就用它做了一个 rating 功能, 哈哈, 真是超级简单, 超级方便.  在下面的链接里, 有详细的使用说明, 只要你的英语不是很烂, 就很容易搞明白如何使用.
具体地址: RichUI Plugin

By javafuns on April 28, 2009 at 21:24 · Views: 2,153 · Permalink · Leave a comment
Categorized in: Scripts · Tagged with: , , , ,

How to disable and enable a component in IE and firefox

How to disable a component in IE and firefox:
document.getElementById(‘xxx’).disabled = true;  // for IE only
document.getElementById(‘xxx’).disabled = ‘disabled’;  // for firefox
and how to enable them:
document.getElementById(‘xxx’).disabled=false;  // for IE only
document.getElementById(‘xxx’).disabled=””;  // for firefox

By javafuns on March 20, 2008 at 11:33 · Views: 511 · Permalink · Leave a comment
Categorized in: Java · Tagged with: 

暴汗,关于javascript的parseInt()的一个问题

这几天在做系统的时候,突然发现时间选择框选择出来的时间总是报告格式不对,通过debug发现是在使用parseInt()的时候报了个错误,奇怪的是该方法转化01,02…07都没问题,但08,09却转化为0。在www.yahoo.cn上搜索,得到如下一位仁兄的文章,才恍然大雾,原来parseInt()有2个参数,第2个参数指出要转化的进制,如果第1个参数是0开头,却又没有指定第2个参数的进制,则该函数会默认为要转化为8进制,所以从08,09就转化为了0.

By javafuns on July 20, 2007 at 00:04 · Views: 405 · Permalink · Leave a comment
Categorized in: Java · Tagged with: 

如何让你的iframe高度和宽度随内嵌网页高度和宽度的变化而变化

from http://www.webjx.com
将如下代码置于你的父页面中,而后在父页面的iframe中通过onload事件调用这个方法:

var getFFVersion = navigator.userAgent.substring(navigator.userAgent.indexOf(”Firefox”)).split(”/”)[1];
//extra height in px to add to iframe in FireFox 1.0+ browsers
var FFextraHeight = getFFVersion >= 0.1 ? 16 : 0;

// iframename 由你的iframe的name属性指定
function dyniframesize(iframename)
{
var pTar = null;

if (document.getElementById)
{
pTar = document.getElementById(iframename);
}
else
{
eval(’pTar = ‘ + iframename + ‘;’);
}

if (pTar && !window.opera)
{
//begin resizing iframe
pTar.style.display=”block”;

alert(pTar.contentDocument.body.offsetHeight);
alert(pTar.contentDocument.body.offsetWidth);
if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight && pTar.contentDocument.body.offsetWidth)
{
//ns6 syntax
pTar.height = pTar.contentDocument.body.offsetHeight + FFextraHeight [...]

By javafuns on August 10, 2006 at 00:07 · Views: 500 · Permalink · Leave a comment
Categorized in: Java · Tagged with: 
  • Highest Rated

  • My PicasaPhotos

    IMG_0615.JPG

    IMG_0653.JPG

    IMG_0564.JPG

  • RSS My del.icio.us

  • My RSS