插件86:状态信息

<?php // Plug-in 86: Status Message

// This is an executable example with additional code supplied
// To obtain just the plug-ins please click on the Download link

echo "It was the ";
echo PIPHP_StatusMessage('best', 'status',
   'The mouse is over the word ‘best’');
echo " of times, it was the ";
echo PIPHP_StatusMessage('worst', 'status',
   'The mouse is over the word ‘worst’');
echo " of times,<br>it was the age of ";
echo PIPHP_StatusMessage('wisdom', 'status',
   'The mouse is over the word ‘wisdom’');
echo " it was the age of ";
echo PIPHP_StatusMessage('foolishness', 'status',
   'The mouse is over the word ‘foolishness’');

echo "<br /><br /><b>Status message</b>: <span id='status'>" .
   "Nothing to report</span>";

function PIPHP_StatusMessage($text, $id, $status)
{
   // Plug-in 86: Status Message
   //
   // This plug-in takes some text that will activate a status
   // message when rolled over with the mouse, the ID of an
   // HTML element whose contents should be used for a status
   // message, and the status message to use. It requires these
   // arguments:
   //
   //    $text:   The text to display and activate a status
   //    $id:     The ID of an HTML element
   //    $status: The message to insert in $id

   $target = "getElementById('$id').innerHTML";
   return    "<span onMouseOver=\"PIPHP_temp=$target; " .
             "$target='$status';\" onMouseOut=\"$target=" .
             "PIPHP_temp;\">$text</span>";
}

?>

插件说明:

本插件接受三个参数:一段需要定义onMouseOver事件的文本;一个可以插入状态信息的HTML元素的ID;状态信息本身。$text和$status都可以是文本或HTML页面。本插件需要以下参数:

$text:需要显示的文本或HTML页面

$id:<span>或<div>等元素的ID.

$status:状态信息,可以是文本或页面HMTL

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值