Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.