Jump to content

Clickable smilies after a WYSIWIG Implementation


Archbob

Recommended Posts

Hi,I've just implemented a WYSIWYG into one of my PHP applications but now the clickable smilies don't work.

 

 

 

 

 

I had this code before:

 

 

 


print "<textarea rows='6' name='post' cols='45'></textarea><br><br>";

    print "<input type='checkbox' name='nosmiley'> Disable Smilies<br><br>";

    print "<input type='submit' name='reply' value='reply'>";

    print "</form>";

    print "Clickable Smilies<br>";

    print "<a onClick=\"addSmiley('')\"><img src='images/smile.gif'></a> "; 

    print "<a onClick=\"addSmiley(':blush')\"><img src='images/blush.gif'></a> ";

    print "<a onClick=\"addSmiley(':angry')\"><img src='images/angry.gif'></a> ";

    print "<a onClick=\"addSmiley(':shocked')\"><img src='images/shocked.gif'></a> ";

    print "<a onClick=\"addSmiley(':cool')\"><img src='images/cool.gif'></a> ";

    print "<a onclick=\"addSmiley(':{blink}')\"><img src='images/winking.gif'></a>";

    print "<A onclick=\"addSmiley('{clover}')\"><img src='images/clover.gif'></a>";

    print "<a onclick=\"addSmiley(':[glasses]')\"><img src='images/glasses.gif'></a>";

    print "<a onclick=\"addSmiley(':[barf]')\"><img src='images/barf.gif'></a>";

    print "<a onclick=\"addSmiley(':[reallymad]')\"><img src='images/mad.gif'></a><br>";

    print "<a onclick=\"addSmiley(':[normal]')\"><img src='../smiley/normal.gif'></a>";

    print "<a onclick=\"addSmiley(':[inqu]')\"><img src='../smiley/inquisitive.gif'></a>";

    print "<a onclick=\"addSmiley(':[happyinlove]')\"><img src='../smiley/happyinlove.gif'></a>";

    print "<a onclick=\"addSmiley(':[sadinlove]')\"><img src='../smiley/sadinlove.gif'></a>";

    print "<a onclick=\"addSmiley(':[normalinlove]')\"><img src='../smiley/normalaboutlove.gif'></a><br>";

    print "<a onclick=\"addSmiley(':[bangry]')\"><img src='../smiley/angry.jpg'></a>";

    print "<a onclick=\"addSmiley(':[grin]')\"><img src='../smiley/grin.jpg'></a>";

    print "<a onclick=\"addSmiley(':[sadness]')\"><img src='../smiley/sadness.jpg'></a>";

    print "<a onclick=\"addSmiley(':[smilies]')\"><img src='../smiley/smiles.jpg'></a>";

    print "<a onclick=\"addSmiley(':[winking]')\"><img src='../smiley/winking.jpg'></a><br>";





    print "<script language=\"JavaScript\" type=\"text/javascript\">\n";

    print "function addSmiley(textToAdd)\n";

    print "{\n";

    print "document.form.post.value += textToAdd;";

    print "document.form.post.focus();\n";

    print "}\n";

    print "</script>\n";

 

 

 

 

 

But now I have this:

 

 

 


print "<textarea id='post' rows='6' name='post' cols='45'></textarea><br><br>";

    print '<script language="JavaScript">';

    print "generate_wysiwyg('post')";

    print "</script>";

    print "<input type='checkbox' name='nosmiley'> Disable Smilies<br><br>";

    print "<input type='submit' name='submitpost' value='Post'>";

    print "</form><br><br>";

    print "Clickable Smilies<br>";

    print "<a onClick=\"addSmiley('')\"><img src='images/smile.gif'></a> "; 

    print "<a onClick=\"addSmiley(':blush')\"><img src='images/blush.gif'></a> ";

    print "<a onClick=\"addSmiley(':angry')\"><img src='images/angry.gif'></a> ";

    print "<a onClick=\"addSmiley(':shocked')\"><img src='images/shocked.gif'></a> ";

    print "<a onClick=\"addSmiley(':cool')\"><img src='images/cool.gif'></a> ";

    print "<a onclick=\"addSmiley(':{blink}')\"><img src='images/winking.gif'></a>";

    print "<A onclick=\"addSmiley('{clover}')\"><img src='images/clover.gif'></a>";

    print "<a onclick=\"addSmiley(':[glasses]')\"><img src='images/glasses.gif'></a>";

    print "<a onclick=\"addSmiley(':[barf]')\"><img src='images/barf.gif'></a>";

    print "<a onclick=\"addSmiley(':[reallymad]')\"><img src='images/mad.gif'></a><br>";

    print "<a onclick=\"addSmiley(':[normal]')\"><img src='../smiley/normal.gif'></a>";

    print "<a onclick=\"addSmiley(':[inqu]')\"><img src='../smiley/inquisitive.gif'></a>";

    print "<a onclick=\"addSmiley(':[happyinlove]')\"><img src='../smiley/happyinlove.gif'></a>";

    print "<a onclick=\"addSmiley(':[sadinlove]')\"><img src='../smiley/sadinlove.gif'></a>";

    print "<a onclick=\"addSmiley(':[normalinlove]')\"><img src='../smiley/normalaboutlove.gif'></a><br>";

    print "<a onclick=\"addSmiley(':[bangry]')\"><img src='../smiley/angry.jpg'></a>";

    print "<a onclick=\"addSmiley(':[grin]')\"><img src='../smiley/grin.jpg'></a>";

    print "<a onclick=\"addSmiley(':[sadness]')\"><img src='../smiley/sadness.jpg'></a>";

    print "<a onclick=\"addSmiley(':[smilies]')\"><img src='../smiley/smiles.jpg'></a>";

    print "<a onclick=\"addSmiley(':[winking]')\"><img src='../smiley/winking.jpg'></a><br>";

    print "<script language=\"JavaScript\" type=\"text/javascript\">\n";

    print "function addSmiley(textToAdd)\n";

    print "{\n";

    print "document.form.post.value += textToAdd;";

    print "document.form.post.focus();\n";

    print "}\n";

    print "</script>\n";

 

 

 

It gives me a "focus not available or invisible error" when I try to click on the smilies, anybody know why?

 

Link to comment
Share on other sites

print "<form action='newtopic.php?forumID=$forumID' method='post' name='form'>";
    if(isset($_SESSION['user']))
    {
      print "<input type='hidden' name='name' value=$getid3[userID]><br>";
      print "<b>Name:</b> $user<br>"; 
    }
    else
    { 
      $getguest="SELECT * FROM b_users WHERE username='Guest'";
      $getguest2=mysql_query($getguest);
      $getguest3=mysql_fetch_array($getguest2);
      print "<input type='hidden' name='name' value='$getguest3[userID]'><br>";
      print "<b>Name:</b> Guest<br>";
    }    
    print "<b>Topic:</b><br>";
    print "<input type='text' name='title' length='15'><br><br>";
    print "<b>Message:</b><br><br>";   
    print "<textarea id='post' rows='6' name='post' cols='45'></textarea><br><br>";
    print '<script language="JavaScript">';
    print "generate_wysiwyg('post')";
    print "</script>";
    print "<input type='checkbox' name='nosmiley'> Disable Smilies<br><br>";
    print "<input type='submit' name='submitpost' value='Post'>";
    print "</form><br><br>";
    print "Clickable Smilies<br>";
    print "<a onClick=\"addSmiley('')\"><img src='images/smile.gif'></a> ";	
    print "<a onClick=\"addSmiley(':blush')\"><img src='images/blush.gif'></a> ";
    print "<a onClick=\"addSmiley(':angry')\"><img src='images/angry.gif'></a> ";
    print "<a onClick=\"addSmiley(':shocked')\"><img src='images/shocked.gif'></a> ";
    print "<a onClick=\"addSmiley(':cool')\"><img src='images/cool.gif'></a> ";
    print "<a onclick=\"addSmiley(':{blink}')\"><img src='images/winking.gif'></a>";
    print "<A onclick=\"addSmiley('{clover}')\"><img src='images/clover.gif'></a>";
    print "<a onclick=\"addSmiley(':[glasses]')\"><img src='images/glasses.gif'></a>";
    print "<a onclick=\"addSmiley(':[barf]')\"><img src='images/barf.gif'></a>";
    print "<a onclick=\"addSmiley(':[reallymad]')\"><img src='images/mad.gif'></a><br>";
    print "<a onclick=\"addSmiley(':[normal]')\"><img src='../smiley/normal.gif'></a>";
    print "<a onclick=\"addSmiley(':[inqu]')\"><img src='../smiley/inquisitive.gif'></a>";
    print "<a onclick=\"addSmiley(':[happyinlove]')\"><img src='../smiley/happyinlove.gif'></a>";
    print "<a onclick=\"addSmiley(':[sadinlove]')\"><img src='../smiley/sadinlove.gif'></a>";
    print "<a onclick=\"addSmiley(':[normalinlove]')\"><img src='../smiley/normalaboutlove.gif'></a><br>";
    print "<a onclick=\"addSmiley(':[bangry]')\"><img src='../smiley/angry.jpg'></a>";
    print "<a onclick=\"addSmiley(':[grin]')\"><img src='../smiley/grin.jpg'></a>";
    print "<a onclick=\"addSmiley(':[sadness]')\"><img src='../smiley/sadness.jpg'></a>";
    print "<a onclick=\"addSmiley(':[smilies]')\"><img src='../smiley/smiles.jpg'></a>";
    print "<a onclick=\"addSmiley(':[winking]')\"><img src='../smiley/winking.jpg'></a><br>";

    print "<script language=\"JavaScript\" type=\"text/javascript\">\n";
    print "function addSmiley(textToAdd)\n";
    print "{\n";
    print "document.form.post.value += textToAdd;";
    print "document.form.post.focus();\n";
    print "}\n";
    print "</script>\n";

 

Thats my form, its wrapped in PHP but its a pretty basic form.

Link to comment
Share on other sites

Its the same thing with PHP, just less the print command. I'm just telling PHP to prink out the HTML there:

 

<form action='newtopic.php?forumID=$forumID' method='post' name='form'>
<b>Topic:</b><br>
    <input type='text' name='title' length='15'><br><br>
    <b>Message:</b><br><br>
    <textarea id='post' rows='6' name='post' cols='45'></textarea><br><br>
    <script language="JavaScript">
    generate_wysiwyg('post')
    </script>
    <input type='checkbox' name='nosmiley'> Disable Smilies<br><br>
    <input type='submit' name='submitpost' value='Post'>
    </form><br><br>
    Clickable Smilies<br>
    <a onClick=\"addSmiley('')\"><img src='images/smile.gif'></a> 	
    <a onClick=\"addSmiley(':blush')\"><img src='images/blush.gif'></a> 
    <a onClick=\"addSmiley(':angry')\"><img src='images/angry.gif'></a> 
    <a onClick=\"addSmiley(':shocked')\"><img src='images/shocked.gif'></a> 
    <a onClick=\"addSmiley(':cool')\"><img src='images/cool.gif'></a> 
    <a onclick=\"addSmiley(':{blink}')\"><img src='images/winking.gif'></a>
    <A onclick=\"addSmiley('{clover}')\"><img src='images/clover.gif'></a>
    <a onclick=\"addSmiley(':[glasses]')\"><img src='images/glasses.gif'></a>
    <a onclick=\"addSmiley(':[barf]')\"><img src='images/barf.gif'></a>
    <a onclick=\"addSmiley(':[reallymad]')\"><img src='images/mad.gif'></a><br>
    <a onclick=\"addSmiley(':[normal]')\"><img src='../smiley/normal.gif'></a>
    <a onclick=\"addSmiley(':[inqu]')\"><img src='../smiley/inquisitive.gif'></a>
    <a onclick=\"addSmiley(':[happyinlove]')\"><img src='../smiley/happyinlove.gif'></a>
    <a onclick=\"addSmiley(':[sadinlove]')\"><img src='../smiley/sadinlove.gif'></a>
    <a onclick=\"addSmiley(':[normalinlove]')\"><img src='../smiley/normalaboutlove.gif'></a><br>
    <a onclick=\"addSmiley(':[bangry]')\"><img src='../smiley/angry.jpg'></a>
    <a onclick=\"addSmiley(':[grin]')\"><img src='../smiley/grin.jpg'></a>
    <a onclick=\"addSmiley(':[sadness]')\"><img src='../smiley/sadness.jpg'></a>
    <a onclick=\"addSmiley(':[smilies]')\"><img src='../smiley/smiles.jpg'></a>
    <a onclick=\"addSmiley(':[winking]')\"><img src='../smiley/winking.jpg'></a><br>

    <script language=\"JavaScript\" type=\"text/javascript\">
    function addSmiley(textToAdd)
   {\n
  document.form.post.value += textToAdd;
  document.form.post.focus();
    }
    </script>

 

Basically you can see it here: http://www.chipmunk-scripts.com/board/newtopic.php?forumID=36

 

Don't actually post please because guest posting is turned off.

Link to comment
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.