freak0 Posted January 12, 2011 Share Posted January 12, 2011 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 More sharing options...
brianlange Posted January 12, 2011 Share Posted January 12, 2011 This question should be posted in the php forum. Link to comment https://forums.phpfreaks.com/topic/224181-clickable-smiley-code-issue/#findComment-1158436 Share on other sites More sharing options...
freak0 Posted January 12, 2011 Author Share Posted January 12, 2011 I already posted in php topic but it moved here. Anyway i need help about that. Link to comment https://forums.phpfreaks.com/topic/224181-clickable-smiley-code-issue/#findComment-1158610 Share on other sites More sharing options...
brianlange Posted January 13, 2011 Share Posted January 13, 2011 can you post a url? It'll be easier to help if all the html is available. Link to comment https://forums.phpfreaks.com/topic/224181-clickable-smiley-code-issue/#findComment-1158722 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.