0

我有一个 php web 应用程序项目......我想实现一个 javascript onclick 代码.. 例如:当用户点击跟随这篇文章...... MySQL 查询插入到用户遵循这个的数据库......所以页面被刷新,之后它将显示为 FOLLOWED .. 执行此操作所需的 javascript 代码是什么......或者是否有任何适合的示例?

这是一个示例代码

     <div id="main_content">


        <?php

        if(isset($_GET['et']))
        {
        $et = $_GET['et'];
        }
        $result = mysql_query("select * from events where event_type =$et") ;

        require_once('queries/category_extract.php') ;

        ?>

        <div id="body_content">
    <div id="event_tag">
        <a><?php echo $cattitle["categ_title"]?>s</a>
    </div>

    <?php
    while($row=mysql_fetch_array($result) )
    {

        require('queries/followers_extract.php') 
        ?>



        <div id="postpreview">
        <div id="postpreview_up">
            <div id="postpreview_up_left">
                    <div id="postpreview_up_left_left">
                        <a>Event Title :</a>
                    </div>

                    <div id="postpreview_up_left_right">
                    <a><?php echo $row["event_title"] ?></a> 
                    </div>
            </div>

              <div id="postpreview_up_right">
                <img src="images/read_more.gif" />
              </div>
        </div>

        <div id="postpreview_bottom">
            <div id="postpreview_bottom_left">
                <div id="postpreview_bottom_left_left">
                <a>Date :</a>
                </div>

                <div id="postpreview_bottom_left_right">
                <a><?php echo $row["event_date"] ?></a>
                </div>
            </div>
        <div id="postpreview_bottom_right">

                <div id="postpreview_bottom_right_left">
                <?php

                if($follower['follower_id'] ==NULL){echo " <img src='images/follow_button.jpg' /> " ; } 
                    else { echo " <img src='images/follow_closed.jpg' /> " ;}
                ?>
                </div>

                <div id="postpreview_bottom_right_right">
                <?php
                if($follower['follower_id'] !=NULL){ echo " <img src='images/following_button.jpg' /> " ; } 
                else { echo " <img src='images/following_Closed.jpg' /> " ;}

                ?>
                </div>
                <div id="postpreview_bottom_right_right">
                <?php
                if($follower['follower_id'] !=NULL){ echo " <img src='images/unfollow_button.jpg' /> " ; } 
                else { echo " <img src='images/unfollow_closed.jpg' />  " ;}

                ?>

                </div>

        </div>

        </div>

        </div>

        <div id="splitter"></div>
        <?php
    }
    ?>
   <!--End Of Post Preview-->

     <!--End Of Post Preview-->
4

1 回答 1

2

好的去这个:http ://www.9lessons.info/2009/04/exactly-twitter-like-follow-and-remove.html

你必须在我阅读时学习基础知识。

于 2013-05-12T10:19:01.680 回答