我是PHP和JavaScript的新手,我制作了一个PHP发布脚本,我想将twitter linkify添加到用户名。我把javascript放在头上,但没有运气。我遵循了所有的指示,但我无法让它发挥作用。这是我的PHP:
<form align="center" method='post' action='add.php'>
<p>Your status:</p>
<textarea name='body' rows='5' cols='40' wrap=VIRTUAL></textarea>
<p> What color is a banana? (lowercase) </p>
<input type="text" class="blah" name="age" />
<input align="center" type="submit" class="submit" value="Post" disabled="disabled"/>
</form>
<script type="text/javascript">
$('.blah').change(function() {
$(".submit").attr('disabled', $(this).val() != "yellow");
}).change();
</script>
<?php
$posts = show_posts($_SESSION['userid']);
if (count($posts)){
?>
<table class="imagetable">
<table align="center" border='0' cellspacing='0' cellpadding='5' width='300'>
<?php
foreach ($posts as $key => $list){
echo "<tr valign='middle'>\n";
echo "<td>".$list['body'] ."<br/>\n ";
echo "<small>".$list['stamp'] ."</small><hr></td>\n";
echo "</tr>\n";
}
?>
</table>
<?php
}else{
?>
<p><b>You haven't posted anything yet!</b></p>
<?php
}
?>
</body>
</html>
这是<head>
:
<script type="text/javascript">
twttr.anywhere(function (T) {
T.linkifyUsers();
});
</script>
“Hi @stackoverflow”中有人输入@stackoverflow会链接到Twitter个人资料页面吗?