<?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