<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Linux&#124;系统管理&#124;WEB开发 &#187; xajax</title>
	<atom:link href="http://blog.wgzhao.com/tag/xajax/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.wgzhao.com</link>
	<description>关注Linux，系统管理，WEB开发以及开源世界</description>
	<lastBuildDate>Sat, 28 Aug 2010 08:57:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Edit in Place</title>
		<link>http://blog.wgzhao.com/2006/01/03/Edit-in-Place.html</link>
		<comments>http://blog.wgzhao.com/2006/01/03/Edit-in-Place.html#comments</comments>
		<pubDate>Tue, 03 Jan 2006 01:19:36 +0000</pubDate>
		<dc:creator>wgzhao</dc:creator>
				<category><![CDATA[WEB开发]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[web2.0]]></category>
		<category><![CDATA[xajax]]></category>

		<guid isPermaLink="false">http://localhost/wordpress/?p=231</guid>
		<description><![CDATA[AJAX的一个最大特点是可以尽量的减少页面跳转，比如我们可以把浏览和编辑文字内容放到一个页面，先看看下面的这个例子edit in place这个例子使用了XAJAX工具，php的Smarty工具。当然如果仅仅只是为了演示这样的一个功能，你完全可以使用自己简单的使用xmlhttprequest这个类，我这里这样写只是想展示如何利用这些工具来构建这样的页面。上面的这个例子报行了四个文件:edit.css,edit.tpl,edit.php,edit.js，edit.css是一个简单的改变元素表示行为的css标签；edit.tpl是简单的一个模板；edit.php简单实现如果保存用户修改的数据，演示代码中没有采用把用户修改的数据保存到数据的做法，只是简单的回应而已；edit.js是实现元素的显示和隐藏，并使用AJAX调用php函数。下面是这些文件的内容$cat edit.css body{ [color=blue]font-family:[color=orange] arial, helvetica, sans-serif [color=blue]font-size:[color=orange] small } [color=green].editable, textarea{ [color=blue]background-color:[color=orange] #ffffd3 } textarea{ [color=blue]width:[color=orange] 95% [color=blue]font-size:[color=orange] 100% } img[color=green].progress{ [color=blue]vertical-align:[color=orange] middle [color=blue]padding:[color=orange] 0 10px }$cat edit.tpl {$xajax_javascript} {$orig}]]></description>
			<content:encoded><![CDATA[<p>AJAX的一个最大特点是可以尽量的减少页面跳转，比如我们可以把浏览和编辑文字内容放到一个页面，先看看下面的这个例子<br/><a href="http://name.xplore.cn/edit.php" target="_blank">edit in place</a><br/><br/>这个例子使用了<a href="http://xajax.sourceforget.net" target="_blank">XAJAX</a>工具，php的<a href="http://smarty.php.net" target="_blank">Smarty</a>工具。<br/>当然如果仅仅只是为了演示这样的一个功能，你完全可以使用自己简单的使用xmlhttprequest这个类，我这里这样写只是想展示如何利用这些工具来构建这样的页面。<br/><span id="more-231"></span><br/>上面的这个例子报行了四个文件:edit.css,edit.tpl,edit.php,edit.js，edit.css是一个简单的改变元素表示行为的css标签；<br/>edit.tpl是简单的一个模板；edit.php简单实现如果保存用户修改的数据，演示代码中没有采用把用户修改的数据保存到数据的做法，只是简单的回应而已；edit.js是实现元素的显示和隐藏，并使用AJAX调用php函数。<br/>下面是这些文件的内容<br/><coolcode>$cat edit.css<br />
body{<br />
        [color=blue]font-family</span>:[color=orange] arial, helvetica, sans-serif</span><br />
        [color=blue]font-size</span>:[color=orange] small</span><br />
}</p>
<p>[color=green].editable</span>, textarea{<br />
        [color=blue]background-color</span>:[color=orange] #ffffd3</span><br />
}</p>
<p>textarea{<br />
        [color=blue]width</span>:[color=orange] 95%</span><br />
        [color=blue]font-size</span>:[color=orange] 100%</span><br />
}</p>
<p>img[color=green].progress</span>{<br />
        [color=blue]vertical-align</span>:[color=orange] middle</span><br />
        [color=blue]padding</span>:[color=orange] 0 10px</span><br />
}</coolcode><br/><br/><coolcode>$cat edit.tpl<br />
<html xmlns="http://www.w3.org/1999/xhtml" ><br />
<head><br />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></p>
<link rel="stylesheet" type="text/css" href="css/edit.css" />
<script type="text/javascript" src="js/edit.js" ></script><br />
{$xajax_javascript}<br />
</head><br />
<body ></p>
<form method="POST"  id="top">
<p id="orig" onclick="editit(this)" onmouseover="change_color(&#039;add&#039;,this)"<br />
onmouseout="change_color(&#039;remove&#039;,this)">{$orig}
</p>
<div id=&#039;cp&#039; style="display:none">
<textarea name=&#039;mirror&#039; id=&#039;mirror&#039; rows=&#039;20&#039; cols=&#039;80&#039;></textarea>
</div>
<div id=&#039;save&#039; style="display:none">
<input type="button" onclick="call_saveit(xajax.getFormValues(&#039;top&#039;))" id="ok" value="save" />
<input type="button" value="cancel" onclick="cancel()"; />
</div>
</form>
<p></body><br />
</html></coolcode><br/></p>
<div style="float:left;margin:0px 0px 0px 0px;"><a title="Post on Google Buzz" class="google-buzz-button" href="http://www.google.com/buzz/post" data-button-style="small-count" data-url="http://blog.wgzhao.com/2006/01/03/Edit-in-Place.html"></a><script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.wgzhao.com/2006/01/03/Edit-in-Place.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
