silverlight课程 silverlight 数据绑定

silverlight教程 silverlight 数据绑定

以往为了做wtt测试,曾经写过一个sample 的WPF application.对于silverlight的了解,仅限于是web 版的WPF。。。。。
关于silverlight,以前也做过一个sample,但仅仅是拖动一些控件到页面上,无任何其他功能。
今天做的这个silverlight程序,相当于把培训的内容重新复习了一遍,包含两个内容:
1. silverlight 简单数据绑定。
2.silverlight 4 新增的ICommand 接口的使用。
3.silverlight 中简单的automation 的实现。
关于topic1:
silverlight实现了view和model的分离,可以使页面设计者和程序员分开工作。如何实现呢?
silverlight控件例如 textblock,textbox,listbox等等,都可以和程序中的某个属性,进行绑定。
当程序员构建了一个class以后,在前端xaml文件的相应控件标签中加入 Text={Binding PropertyName}
例如:

public class sampleclass
{
private string text = "Hello World";
public string Text
{
get{return text;}
set{text=value;}
}
}


前端xaml
<TextBlock x:Name="HelloText" Text={Binding Text}>
这样就实现了将TextBlock中的Text和一个类中的属性进行绑定;
当然,还需要给TextBlock指定一个数据上下文datacontext(因为也许在你的众多类中,都有一个叫做Text的属性,那么程序怎么知道应该绑定哪个class或者哪个数据对象的Text呢,这里的datacontext就是起到这个作用)
可以在页面Intialize的时候指定this.DataContext = new sampleclass();
也可以在xaml文件中用resource标签中指定,还有很多其他的制定方法,这里暂不讨论;
这里还涉及到一个BindMode的问题,一共有三种OneTime,OneWay, TwoWay.
OneTime 指一次绑定,无论属性有没有发生变法,前台的现实都是不会改变的;
OneWay 指在绑定过程中,如果后台的属性发生改变,会直接在前台显示出来;
TwoWay 指在绑定过程中,前后台可以交互,相互影响;
在实现OneWay和TwoWay的时候,需要注意的是包含属性的对象,需要实现INotifyPropertyChanged
也就是通知系统属性的变化,具体代码:
 
public class simpleclass:INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        private string text = "Hello World";
        private Command _saveCommand = null;
        public string Text
        {
            set { text = value; OnPropertyChanged("Text"); }
            get { return text; }
        }
  
        protected void OnPropertyChanged(string value)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(value));
            }
        }

关于topic2:
在silverlight以往的版本中,还无法实现对事件的直接绑定,在silverlight4中,可以实现对事件的绑定只要实现了ICommand接口,具体方法如下:
 

public class Command : ICommand
    {
        public event EventHandler CanExecuteChanged;
        Predicate<object> _canExecute = null;
        Action<object> _excuteAction = null;
        public Command(Predicate<object> canExecute, Action<object> excuteAction)
        {
            _canExecute = canExecute;
            _excuteAction = excuteAction;
        }
        public bool CanExecute(object parameter)
        {
            if (_canExecute != null)
                return _canExecute(parameter);
            return true;
        }
 
        public void Execute(object parameter)
        {
            if (_excuteAction != null)
                _excuteAction(parameter);
            if (CanExecuteChanged != null)
                CanExecuteChanged(this, new EventArgs());
        }
    }
 </object>在simpleclass中加入方法<br>
public class simpleclass: INotifyPropertyChanged<br>
{<br>
........<br>
private Command _saveCommand;<br>
//实现具体的方法<br>
public Command SaveCommand<br>
{<br>
get<br>
{<br>
if(_saveCommand == null)<br>
  _saveCommand = new Command<br>
(<br>
p => true,<br>
p => Text = "Hello World Changed!!"<br>
);<br>
return _saveCommand;<br>
}<br>
}<br>
}<br>
xaml中<br>
<TextBlock x:Name="HelloText" Text="{Binding Text}" Command = "{Binding SaveCommand}"><br>
这样就实现了command的绑定
                           <p></p>
                           <p>
                              <br>
                               原文地址:http://www.itmmd.com/201410/68.html   <br>
                               该文章由 <a href="http://www.itmmd.com" disabled="true">萌萌的IT人</a> 整理发布,转载须标明出处。
                           </p>
                         
                       <div id="digg" style="display:none">
                            <dl id="btnDigg" class="digg digg_disable">
                                <dt onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_ding'])">顶</dt>
                                <dd>11</dd>
                            </dl>
                            <dl id="btnBury" class="digg digg_disable">
                                <dt onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_cai'])">踩</dt>
                                <dd>0</dd>
                            </dl>
                        </div>
                        <div id="article_next_prev">
                            <dl class="pre">
                                <dd><a href="/201410/69.html" disabled="true">  cocos2d-x Tests学习:整体架构 </a>  上一篇</dd>
                            </dl>
                            <dl class="next">
                                <dd>下一篇  <a href="/201410/58.html" disabled="true">Android 开发问题!No Launcher activity found!错误</a></dd>
                            </dl>
                        </div>
                         
                         
                        <div id="ad_5">
                            <dl id="btnDigg" class="ad_5_left">
                                    <script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
                                    <!-- itmmd -->
                                    <ins class="adsbygoogle" style="display:inline-block;width:300px;height:250px" data-ad-client="ca-pub-2876867208357149" data-ad-slot="6508889425"></ins>
                                    <script>
                                    (adsbygoogle = window.adsbygoogle || []).push({});
                                    </script>
                            </dl>
                            <dl id="btnBury" class="ad_5_right">
                                    <script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
                                    <!-- itmmd -->
                                    <ins class="adsbygoogle" style="display:inline-block;width:300px;height:250px" data-ad-client="ca-pub-2876867208357149" data-ad-slot="6508889425"></ins>
                                    <script>
                                    (adsbygoogle = window.adsbygoogle || []).push({});
                                    </script>
                            </dl>
                        </div>
                        <div class="replyS">
                            <br>
                                <b> 精彩回复 </b>
                              </div>
                       <div class="content_list">  
                       </div>
                       <div>
                       <table cellspacing="1" cellpadding="1" border="0">   
                            <tbody><tr>
                            <td>
                                <form id="form_pl">
                                    <table width="700px" border="0" cellspacing="0" cellpadding="0">
                                        <tbody><tr>
                                            <td height="28" colspan="5" class="gd2">
                                                发表评论
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="4" align="left" class="gd2">
                                                <textarea name="plnr" rows="3" id="plnr" style="width: 95%" disabled=""></textarea>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td height="10" colspan="4"></td>
                                        </tr>
                                        <tr>
                                            <td align="left" class="gd2">
                                                姓名:
                                                <input type="text" id="plr" name="plr" disabled="">
                                                       
                                                <input id="btn_pl" name="btn_pl" type="button" value="发表评论" class="btn" disabled="">
                                            </td>
                                        </tr>
                                    </tbody></table>
                                </form>
                            </td>
                        </tr></tbody></table>
                       </div>
                       <div class="content_end">
                          
                         <div class="content_end_left">         
                           <div class="w_r">       
                            <h4>
                                <a href="/boke.html" disabled="true">最新段子</a>
                                   <span class="more">
                                     <a href="/boke.html" class="right_more" disabled="true">more
                                     </a>
                                   </span>
                            </h4>
                            <ul>
            <li><span class="hot_list1">1</span>                                    <a href="/201412/265.html" target="_blank" disabled="true"><span title="一个群里天猫红包引发" 血案""="">一个群里天猫红包引发"血案"</span></a>
</li>
            <li><span class="hot_list2">2</span>                                    <a href="/201412/241.html" target="_blank" disabled="true"><span title="作为一个游戏策划,我已经被程序员玩死3次了!这一次也不靠谱!!!">作为一个游戏策划,我已经被程序员玩死3次了!这一次也不靠谱!...</span></a>
</li>
            <li><span class="hot_list3">3</span>                                    <a href="/201411/218.html" target="_blank" disabled="true"><span title="面向对象编程?没有对象你编毛程序!!!">面向对象编程?没有对象你编毛程序!!!</span></a>
</li>
            <li><span class="hot_list">4</span>                                 <a href="/201411/185.html" target="_blank" disabled="true"><span title="逗比的程序员,逗比产生的娱乐,先给大家~~~">逗比的程序员,逗比产生的娱乐,先给大家~~~</span></a>
</li>
            <li><span class="hot_list">5</span>                                 <a href="/201411/173.html" target="_blank" disabled="true"><span title="IT蛋疼的项目,一张图告诉你项目为什么失控">IT蛋疼的项目,一张图告诉你项目为什么失控</span></a>
</li>
            <li><span class="hot_list">6</span>                                 <a href="/201411/162.html" target="_blank" disabled="true"><span title="!!中兴、华为、大唐、波导、魅族正商讨合并,新品牌将命名为“中华大波妹”!!">!!中兴、华为、大唐、波导、魅族正商讨合并,新品牌将命名为“...</span></a>
</li>
            <li><span class="hot_list">7</span>                                 <a href="/201411/150.html" target="_blank" disabled="true"><span title="假如生活欺骗了你,找50个程序员问问为什么编程">假如生活欺骗了你,找50个程序员问问为什么编程</span></a>
</li>
            <li><span class="hot_list">8</span>                                 <a href="/201411/124.html" target="_blank" disabled="true"><span title="程序员表白......逗比了">程序员表白......逗比了</span></a>
</li>
            <li><span class="hot_list">9</span>                                 <a href="/201411/105.html" target="_blank" disabled="true"><span title="程序员、设计师、项目经理眼中的他们">程序员、设计师、项目经理眼中的他们</span></a>
</li>
            <li><span class="hot_list">10</span>                                    <a href="/201410/82.html" target="_blank" disabled="true"><span title="国外程序员经典笑话7:世界山最聪明的人">国外程序员经典笑话7:世界山最聪明的人</span></a>
</li>
                             
                            </ul>
                         </div>
                        </div>
                        <div class="content_end_right">      
                           <a href="/201410/49.html" target="_blank" disabled="true">     
                            <img border="0" alt="程序员永远活在另一个世界中" src="/html/kindeditor/pic/20141019/2014101922174609736341.jpg" width="360" height="360">
                           </a>
                        </div>
                     </div>
                     
                     
                                  
 
                     
                   <div id="siderList">
 
                       <div class="baoPic">
                           <a href="/boke.html" disabled="true">
                               <img alt="超神了,暴走了...." class="logo" src="/site/images/zhaolezi.gif" title="超神了,暴走了....写代码疯了~快来看逗比乐乐吧!" width="300px" height="60px">
                           </a>
                        </div>
 
 
                       <div class="ad2">
                            <script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
                            <!-- itmmd 侧边栏 -->
                            <ins class="adsbygoogle" style="display:inline-block;width:300px;height:250px" data-ad-client="ca-pub-1944176156128447" data-ad-slot="8736056345"></ins>
                            <script>
                            (adsbygoogle = window.adsbygoogle || []).push({});
                            </script>
                        </div>
 
                        <div class="news">
                              
                            <div class="w_r">             
                            <h4>
                                <a href="/boke.html" disabled="true">最新段子</a>
                                   <span class="more">
                                     <a href="/boke.html" class="right_more" disabled="true">more
                                     </a>
                                   </span>
                            </h4>
                            <ul>
            <li><span class="hot_list1">1</span>                                    <a href="/201412/265.html" target="_blank" disabled="true"><span title="一个群里天猫红包引发" 血案""="">一个群里天猫红包引发"血案"</span></a>
</li>
            <li><span class="hot_list2">2</span>                                    <a href="/201412/241.html" target="_blank" disabled="true"><span title="作为一个游戏策划,我已经被程序员玩死3次了!这一次也不靠谱!!!">作为一个游戏策划,我已经被程序员玩死3次了!这一次也不靠谱!...</span></a>
</li>
            <li><span class="hot_list3">3</span>                                    <a href="/201411/218.html" target="_blank" disabled="true"><span title="面向对象编程?没有对象你编毛程序!!!">面向对象编程?没有对象你编毛程序!!!</span></a>
</li>
            <li><span class="hot_list">4</span>                                 <a href="/201411/185.html" target="_blank" disabled="true"><span title="逗比的程序员,逗比产生的娱乐,先给大家~~~">逗比的程序员,逗比产生的娱乐,先给大家~~~</span></a>
</li>
            <li><span class="hot_list">5</span>                                 <a href="/201411/173.html" target="_blank" disabled="true"><span title="IT蛋疼的项目,一张图告诉你项目为什么失控">IT蛋疼的项目,一张图告诉你项目为什么失控</span></a>
</li>
            <li><span class="hot_list">6</span>                                 <a href="/201411/162.html" target="_blank" disabled="true"><span title="!!中兴、华为、大唐、波导、魅族正商讨合并,新品牌将命名为“中华大波妹”!!">!!中兴、华为、大唐、波导、魅族正商讨合并,新品牌将命名为“...</span></a>
</li>
            <li><span class="hot_list">7</span>                                 <a href="/201411/150.html" target="_blank" disabled="true"><span title="假如生活欺骗了你,找50个程序员问问为什么编程">假如生活欺骗了你,找50个程序员问问为什么编程</span></a>
</li>
            <li><span class="hot_list">8</span>                                 <a href="/201411/124.html" target="_blank" disabled="true"><span title="程序员表白......逗比了">程序员表白......逗比了</span></a>
</li>
            <li><span class="hot_list">9</span>                                 <a href="/201411/105.html" target="_blank" disabled="true"><span title="程序员、设计师、项目经理眼中的他们">程序员、设计师、项目经理眼中的他们</span></a>
</li>
            <li><span class="hot_list">10</span>                                    <a href="/201410/82.html" target="_blank" disabled="true"><span title="国外程序员经典笑话7:世界山最聪明的人">国外程序员经典笑话7:世界山最聪明的人</span></a>
</li>
                             
                            </ul>
                            </div>
 
                        </div>
                         
                        <div class="baozou">
                            <script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
                            <!-- itmmd 侧边栏 -->
                            <ins class="adsbygoogle" style="display:inline-block;width:300px;height:250px" data-ad-client="ca-pub-1944176156128447" data-ad-slot="8736056345"></ins>
                            <script>
                            (adsbygoogle = window.adsbygoogle || []).push({});
                            </script>
                        </div>
                         
                         
                        <div class="news">
                              
                            <div class="w_r">             
                            <h4>
                                <a href="/news.html" disabled="true">最新新闻</a>
                                   <span class="more">
                                     <a href="/news.html" class="right_more" disabled="true">more
                                     </a>
                                   </span>
                            </h4>
                            <ul>
            <li><span class="hot_list1">1</span>                                    <a href="/201412/298.html" target="_blank" disabled="true"><span title="目前全网的运营商正在遭受来自僵尸网络的反射攻击">目前全网的运营商正在遭受来自僵尸网络的反射攻击</span></a>
</li>
            <li><span class="hot_list2">2</span>                                    <a href="/201411/163.html" target="_blank" disabled="true"><span title="天猫双十一巨量成交额的背后 余额宝牺牲了多少人理财者的利益?">天猫双十一巨量成交额的背后 余额宝牺牲了多少人理财者的利益?</span></a>
</li>
            <li><span class="hot_list3">3</span>                                    <a href="/201411/131.html" target="_blank" disabled="true"><span title="浪潮天梭K1对垒HP小型机技高一筹">浪潮天梭K1对垒HP小型机技高一筹</span></a>
</li>
            <li><span class="hot_list">4</span>                                 <a href="/201411/127.html" target="_blank" disabled="true"><span title="浪潮天梭K1系统应用农业部成功替换">浪潮天梭K1系统应用农业部成功替换</span></a>
</li>
            <li><span class="hot_list">5</span>                                 <a href="/201410/61.html" target="_blank" disabled="true"><span title="Spring Sync ,基于Spring服务器之间的数据交换....">Spring Sync ,基于Spring服务器之间的数据交...</span></a>
</li>
            <li><span class="hot_list">6</span>                                 <a href="/201410/60.html" target="_blank" disabled="true"><span title="apache log4j 2.1 发布,提供了很多心功能">apache log4j 2.1 发布,提供了很多心功能</span></a>
</li>
            <li><span class="hot_list">7</span>                                 <a href="/201410/59.html" target="_blank" disabled="true"><span title="IT人!打破新的***落体运行">IT人!打破新的***落体运行</span></a>
</li>
            <li><span class="hot_list">8</span>                                 <a href="/201410/41.html" target="_blank" disabled="true"><span title="Google Shopping Express 谷歌快车 正在高速运行,谷歌在多个城市开启了快递服务,并启用新的服务名字“会员费”">Google Shopping Express 谷歌快车 正...</span></a>
</li>
            <li><span class="hot_list">9</span>                                 <a href="/201410/40.html" target="_blank" disabled="true"><span title="Dropbox 出现bug导致删除了一部分云端的用户文件">Dropbox 出现bug导致删除了一部分云端的用户文件</span></a>
</li>
            <li><span class="hot_list">10</span>                                    <a href="/201410/39.html" target="_blank" disabled="true"><span title="电商逆发展,要玩实体店了吗?亚马逊频繁开设假期临时商店~~">电商逆发展,要玩实体店了吗?亚马逊频繁开设假期临时商店~~</span></a>
</li>
                             
                            </ul>
                            </div>
 
                        </div>
                        <div class="ad2">
                            <script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
                            <!-- itmmd 侧边栏 -->
                            <ins class="adsbygoogle" style="display:inline-block;width:300px;height:250px" data-ad-client="ca-pub-1944176156128447" data-ad-slot="8736056345"></ins>
                            <script>
                            (adsbygoogle = window.adsbygoogle || []).push({});
                            </script>
                        </div>
                        <div class="tagList">
                         <div class="w_r">  
                            <h4>
                                <a href="/boke.html" disabled="true">标签云</a>
                                   <span class="more">
                                     <a href="/boke.html" class="right_more" disabled="true">
                                     more
                                     </a>
                                   </span>
                        </h4>
                                                </div>
 
                             <ul class="classify">
                                 
                                       <li><a href="/tag/android.html" title="tagNum" disabled="true">android</a></li>
                                       <li><a href="/tag/android_intent_2.html" title="tagNum" disabled="true">android-intent</a></li>
                                       <li><a href="/tag/android新手入门_2.html" title="tagNum" disabled="true">android新手入门</a></li>
                                       <li><a href="/tag/linux命令详解_2.html" title="tagNum" disabled="true">linux命令详解</a></li>
                                       <li><a href="/tag/linux学习笔记_2.html" title="tagNum" disabled="true">linux学习笔记</a></li>
                                       <li><a href="/tag/程序员笑话.html" title="tagNum" disabled="true">程序员笑话</a></li>
                                       <li><a href="/tag/android_listview.html" title="tagNum" disabled="true">android-listview</a></li>
                                       <li><a href="/tag/android5.0.html" title="tagNum" disabled="true">android5.0</a></li>
                                       <li><a href="/tag/android开发.html" title="tagNum" disabled="true">android开发</a></li>
                                       <li><a href="/tag/大型网站架构设计.html" title="tagNum" disabled="true">大型网站架构设计</a></li>
                                       <li><a href="/tag/spring_mvc新手入门.html" title="tagNum" disabled="true">spring-mvc新手入门</a></li>
                                       <li><a href="/tag/spring_mvc教程.html" title="tagNum" disabled="true">spring-mvc教程</a></li>
                                       <li><a href="/tag/产品经理.html" title="tagNum" disabled="true">产品经理</a></li>
                                       <li><a href="/tag/java.html" title="tagNum" disabled="true">java</a></li>
                                       <li><a href="/tag/android学习笔记.html" title="tagNum" disabled="true">android学习笔记</a></li>
                                       <li><a href="/tag/android_layout.html" title="tagNum" disabled="true">android-layout</a></li>
                                       <li><a href="/tag/java_rest.html" title="tagNum" disabled="true">java-rest</a></li>
                                       <li><a href="/tag/javascript.html" title="tagNum" disabled="true">javascript</a></li>
                                       <li><a href="/tag/memcache.html" title="tagNum" disabled="true">memcache</a></li>
                                       <li><a href="/tag/ios开发.html" title="tagNum" disabled="true">ios开发</a></li>
                                  
                            </ul>
                        </div>
                         
                         <div class="baozou" style="background:url(/site/images/duanzi.gif)">
                              <a href="/boke.html" disabled="true">
                              </a>
                         </div>
                        <div class="news">
                              
                            <div class="w_r">             
                            <h4>
                                <a href="/mobile.html" disabled="true">移动开发</a>
                                   <span class="more">
                                     <a href="/mobile.html" class="right_more" disabled="true">more
                                     </a>
                                   </span>
                            </h4>
                            <ul>
            <li><span class="hot_list1">1</span>                                    <a href="/201412/297.html" target="_blank" disabled="true"><span title="android 以编码的方式列出来当前app所有的窗口">android 以编码的方式列出来当前app所有的窗口</span></a>
</li>
            <li><span class="hot_list2">2</span>                                    <a href="/201412/296.html" target="_blank" disabled="true"><span title="android ksoap2 中把XML(DataSet)  当做参数传递">android ksoap2 中把XML(DataSet) ...</span></a>
</li>
            <li><span class="hot_list3">3</span>                                    <a href="/201412/290.html" target="_blank" disabled="true"><span title="Android 5.0 - ProgressBar 进度条无法展示到按钮的前面 ">Android 5.0 - ProgressBar 进度条无...</span></a>
</li>
            <li><span class="hot_list">4</span>                                 <a href="/201412/289.html" target="_blank" disabled="true"><span title="在低于android  5.0的版本中ActionBar不显示 ">在低于android  5.0的版本中ActionBar不显...</span></a>
</li>
            <li><span class="hot_list">5</span>                                 <a href="/201412/278.html" target="_blank" disabled="true"><span title="android apk 加密无法破解,apk破解 ">android apk 加密无法破解,apk破解 </span></a>
</li>
            <li><span class="hot_list">6</span>                                 <a href="/201412/271.html" target="_blank" disabled="true"><span title="android学习笔记(13)android幀布局">android学习笔记(13)android幀布局</span></a>
</li>
            <li><span class="hot_list">7</span>                                 <a href="/201412/264.html" target="_blank" disabled="true"><span title="Android图片上传,如何获取上传进度">Android图片上传,如何获取上传进度</span></a>
</li>
            <li><span class="hot_list">8</span>                                 <a href="/201412/263.html" target="_blank" disabled="true"><span title="android app打包部署到手机上报waiting for debugger ">android app打包部署到手机上报waiting fo...</span></a>
</li>
            <li><span class="hot_list">9</span>                                 <a href="/201412/262.html" target="_blank" disabled="true"><span title="android EditText 中的TextWatcher 限制小数点位数">android EditText 中的TextWatcher...</span></a>
</li>
            <li><span class="hot_list">10</span>                                    <a href="/201412/254.html" target="_blank" disabled="true"><span title="Android 5.0 Lollipop 处理 media buttons 事件的问题 ">Android 5.0 Lollipop 处理 media ...</span></a>
</li>
                             
                            </ul>
                            </div>
 
                        </div>
                   </div>
                 
                 <div id="div_footer">
                    <div id="footer">
                      <p> <a href="#" disabled="true">关于我们</a>|<a href="/sitemap.html" disabled="true">网站地图</a> |<a href="#" disabled="true">友情链接</a> </p>
                      <p>
                         <a href="http://www.csdn.net/" target="_blank" disabled="true">CSDN</a>|
                         <a href="http://www.cnblogs.com/" target="_blank" disabled="true">Cnblogs</a>|
                         <a href="http://www.iteye.com/" target="_blank" disabled="true">Iteye</a>
                      </p>
                      <p>
                      <script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_1253495965'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "v1.cnzz.com/stat.php%3Fid%3D1253495965%26online%3D1%26show%3Dline' type='text/javascript'%3E%3C/script%3E"));</script><span id="cnzz_stat_icon_1253495965"><a href="http://www.cnzz.com/stat/website.php?web_id=1253495965" target="_blank">站长统计</a><a href="http://www.cnzz.com/stat/website.php?web_id=1253495965" target="_blank"> |  今日IP[6] | 今日PV[15] | 昨日IP[93] |  昨日PV[203] | </a><a href="http://www.cnzz.com/stat/website.php?web_id=1253495965&method=online" target="_blank">当前在线[1]</a></span><script src=" http://v1.cnzz.com/stat.php?id=1253495965&online=1&show=line" type="text/javascript"></script><script src="http://c.cnzz.com/core.php?web_id=1253495965&show=line&online=1&t=z" charset="utf-8" type="text/javascript"></script>
                      </p>
                      <address>
                        © 2014-2014 itmmd.com 版权所有  <a href="http://www.miitbeian.gov.cn/" disabled="true">鲁ICP备14030133号</a> 联系方式 QQ:372766897
                      </address>            
                     </div>
                </div>
                 
         
          
<script src="/js/jquery-1.4.2.js" type="text/javascript"></script>
<script type="text/javascript" src="/js/SyntaxHighlighter/scripts/shCore.js"></script>
<script type="text/javascript" src="/js/SyntaxHighlighter/scripts/shBrushCSharp.js"></script>
<script type="text/javascript" src="/js/SyntaxHighlighter/scripts/shBrushCss.js"></script>
<script type="text/javascript" src="/js/SyntaxHighlighter/scripts/shBrushJava.js"></script>
<script type="text/javascript" src="/js/SyntaxHighlighter/scripts/shBrushJScript.js"></script>
<script type="text/javascript" src="/js/SyntaxHighlighter/scripts/shBrushSql.js"></script>
<script type="text/javascript" src="/js/SyntaxHighlighter/scripts/shBrushXml.js"></script>
<script type="text/javascript">
                    SyntaxHighlighter.config.clipboardSwf = '/js/SyntaxHighlighter/scripts/clipboard.swf';
                    SyntaxHighlighter.all();
</script>
<script src="/js/ict.js?t=20090221" type="text/javascript"></script>
   <script language="javascript">
      var guid='68';
    $(document).ready(function(){
          
        //每次访问增值服务+1 ,并查询出来最新的增值服务进行展示
        $.ajax({
            url:"/siteweb/module/default.do?method=updateArticleReadCount&guid=68",
            type:"post",
            dataType:"json",
            success:function(json) {
               //刷新访问次数
                jQuery("#visits").html(json.visits);
            }
        });
         
         
        $("#btn_pl").click(function(){
                if($("#plnr").val() == ""){
                    alert("请输入评论内容!");
                    return;
                }
                if($("#plr").val() == ""){
                    alert("请输入姓名!");
                    return;
                }
                var queryString = $("#form_pl").serialize()+"&guid="+guid;
                $.ajax({
                url:"/siteweb/module/default.do?method=saveArticlePl&"+encodeURI(queryString),
                contentType: "application/x-www-form-urlencoded; charset=utf-8",  
                type:"post",
                dataType:"json",
                success:function(json) {
                   if(json.result==true){
                    alert("评论发表成功! 带审批通过后即可展示 !");
                    $('#form_pl')[0].reset();
                    }else{
                        alert("操作失败,请与管理员联系!");
                    }
                }
            });
            });
    });
</script>
 
 
</object></object></object>
原文地址:http://www.itmmd.com/201410/68.html
该文章由 android开发 整理发布,转载须标明出处。