Jump to content

Clickable smiley code issue


freak0

Recommended Posts

First of all, here are all codes:

<?php
add_action('smilies',-1);
function smilies() {
global $smiliestrans;
if ( !get_option('use_smilies') or (empty($smiliestrans))) return;
$smilies = array_unique($smiliestrans);
$link='';
foreach ($smilies as $key => $smile) {
	$file = get_bloginfo('url').'/smilies/'.$smile;
	$value = " ".$key." ";
	$img = "<img src=\"{$file}\" alt=\"{$smile}\" />";
	$imglink = htmlspecialchars($img);
	$link .= "<a href=\"#commentform\" title=\"{$smile}\" onclick=\"document.getElementById('comment').value += '{$value}'\">{$img}</a> ";
}
echo '<div class="smilies">'.$link.'</div>';
}
?>

 

This code is just working in IE.

 

It doesn't work in Firefox and error console says:

document.getElementById("comment") has no properties

 

It doesn't work in Opera and error console says:

Event thread: click

Uncaught exception: TypeError: Cannot convert 'document.getElementById('comment')' to object
Error thrown at line 1, column 0 in <anonymous function>(event):
    document.getElementById('comment').value += '  '

 

It must work in Firefox, Opera and other browsers. What can i do for this? Please help me. Thanks.

Link to comment
https://forums.phpfreaks.com/topic/224181-clickable-smiley-code-issue/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.