posts - 5,comments - 2,trackbacks - 0
首先父窗有一个test()方法。
调用模式窗体window.showModalDialog('/test.html',window)   记得第二个参数一定要把父类窗体当参数传到模式窗体。

模式窗体加入事件
<script for="window" event="onunload">
    dialogArguments.window.test();  
</script>
这样就可以在模式窗体关闭或者是重载的时候调用父类窗体的方法,如果不想让重载的时候调用父窗体的test()方法,可以给父窗体传一个变量,到时候根据变量的值来判断是不是要执行test()方法。



posted @ 2007-05-07 17:04 Pitey 阅读(773) | 评论 (0)编辑 收藏

也许你过去在setTimeout中传参数一直是这样

setTimeout("pass(" + argu + ")",1000)

这样只能传字符串,对传递object就无能为力了,需要大费文章.然而别忘了,第一个参数还可以是function!!!

看以下代码实现向里面的function 传参数

<script type="text/javascript">
var _st = window.setTimeout;window.setTimeout = function(fRef, mDelay) {
if(typeof fRef == 'function'){ 
  var argu 
= Array.prototype.slice.call(arguments,2); 
  var f 
= (function(){ fRef.apply(null, argu); }); 
  return _st(f, mDelay); }
  return
 _st(fRef,mDelay);}

function test(x){ alert(x);}
window.setTimeout(test,
1000,'fason');
</
script>

怎样?是不是很方便了?代码其实就很简单,重载了一下window.setTimeout,用apply去回调前面的function.

还没有用过apply,call的可以去查资料,发现版本不够的看我低版本的实现方法http://blog.csdn.net/fason/archive/2004/07/30/apply_call.aspx

另外需要知道的是,NS环境下,后面的参数确实是来传给前面的函数的,IE烂,没有实现~~~~~~~~~~~~~

posted @ 2008-03-18 10:21 Pitey 阅读(249) | 评论 (1)编辑 收藏
     摘要: Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ -->document.execCommand()用法说明 2D-Position 允许通过拖曳移动绝对定位的对象。 AbsolutePosition 设定元素的&nbs...  阅读全文
posted @ 2008-03-17 21:18 Pitey 阅读(122) | 评论 (0)编辑 收藏
例子:
 获得ifream的对象,并把ifreame中页面<div id="my">隐藏掉

test1.html

<html>
<head>
<script>
function t(){
var dd = document.all('test2').contentWindow.document;
dd.getElementById('my').style.display='none';

}
</script>
</head>
<body >
<input type="button" value="test" onClick="t();"/>
<iframe id="test2" name="test2" src="test2.html"></iframe>
</body>
</html>

test2.html
<html>
<head>
</head>
<body>
    
    
<div id="my" name="my">
       测试一下,父窗体可以把我隐藏掉!!!!!!!!
  
</div>
</body>
</html>



posted @ 2008-03-09 13:48 Pitey 阅读(1263) | 评论 (1)编辑 收藏
applicationContext.xml里面设置

<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean" lazy-init="default" autowire="default" dependency-check="default">
        <property name="jndiName">
            <value>JDBC/TEST</value>           
        </property>
</bean> 或者

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"></property>
        <property name="url" value="jdbc:oracle:thin:@127.0.0.1:1521:ora"></property>
        <property name="username" value="test"></property>
        <property name="password" value="123456"></property>
    </bean>

通过
ServiceLocator.getBean('beanId') 获得"dataSource",ServiceLocator 其实就是自己封装一下,

ApplicationContext ctx;
ctx.getBean("");


通过
DataSourceUtils.getConnection(DataSource);就能获取到设置的DataSource 然后获得connection

public static Connection getConnection()
            
throws SQLException
    {        
        
return DataSourceUtils.getConnection((DataSource)ServiceLocator.getBean("dataSource"));
}

posted @ 2008-03-05 12:45 Pitey 阅读(94) | 评论 (0)编辑 收藏
首先父窗有一个test()方法。
调用模式窗体window.showModalDialog('/test.html',window)   记得第二个参数一定要把父类窗体当参数传到模式窗体。

模式窗体加入事件
<script for="window" event="onunload">
    dialogArguments.window.test();  
</script>
这样就可以在模式窗体关闭或者是重载的时候调用父类窗体的方法,如果不想让重载的时候调用父窗体的test()方法,可以给父窗体传一个变量,到时候根据变量的值来判断是不是要执行test()方法。



posted @ 2007-05-07 17:04 Pitey 阅读(773) | 评论 (0)编辑 收藏
仅列出标题