您的位置:首页 > 其它

学习小结

2012-11-16 12:17 169 查看
<script type="text/javascript">

function fun(){

var new_id=document.createElement('div'); //创建一个图层

//给div设置大小和颜色,通过他的style属性来获得但是设置具体的某个属性还是要根据具体的属性名来设置

new_id.style.width='100px'; //设置长

new_id.style.height='100px'; //设置宽

new_id.style.backgroundColor='blue';//给图层加颜色

new_id.id='div1';//给图层定义一个ID

//确定位置

document.body.appendChild(new_id);//在body里面加入一个子元素new_id

var text=document.createTextNode("^_^^_^^_^"); //创建一个节点

new_id.appendChild(text); //给new_id加入一个字节点

alert(document.getElementByid('div1').nodeName);//弹出一个消息框,显示的是div1里面的值,也就是^_^^_^^_^

}

</script>

</head>

<body>

<input type="button" onClick="fun()" value="确定">

//<?php

include('libs/Smarty.class.php');

$smarty=new Smarty();

$smarty->caching=true; //开启缓存

$smarty->template_dir="demo/templates";

$smarty->compile_dir="demo/templates_c";

$smarty->cache_dir="demo/cache";//设置目录

$smarty->cache_lifetime=30; //设置缓存的生命周期

$smarty->left_delimiter="<{";

$smarty->right_delimiter="}>";

$smarty->assign("a","Hell World abcdefg");

$smarty->assign("b",123);

$smarty->display('capialize.tpl');

?>

<body>

<{$a|change}><br />

<{$a}>--------<{$a|lower}>-------全部小写<br />

<{$a}>--------<{$a|upper}>-------全部大写<br />

<{$a}>--------<{$a|count_characters}>-------不算空格统计字符个数<br />

<{$a}>--------<{$a|cat:"坏人"}>-------cat连接字符<br />

<{$a}>--------<{$a|count_paragraphs}>-------统计段落<br />

<{$a}>--------<{$a|count_sentences}>-------统计句数<br />

<{$a}>--------<{$a|count_words}>-------统计词数<br />

<{$a}>--------<{$a|indent:"4":" "}>-------段落缩进<br />

<{$a}>--------<{$a|replace:$a:"ooxxoo"}>-------替换<br />

<{$a}>--------<{$a|truncate:9:"^":"true"}>-------字符替换<br />

</body>

</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: