login  Naam:   Wachtwoord: 
Registreer je!
 Forum

UBB

Offline raintjah - 04/07/2005 01:35
Avatar van raintjahNieuw lid
  1. <script language="JavaScript">
  2. function smile (code){
  3. document.form.content.value = document.form.content.value + code;
  4. document.form.content.focus();
  5. }
  6. </script>
  7.  
  8. <?PHP
  9. if(!IsSet($_POST['submit']))
  10. {
  11. echo "<Form Method='POST' Action='index.php?page=postcomment'>";
  12.  
  13. echo "Nick: ";
  14.  
  15. echo "<input type='text' name='poster' class='body'>";
  16.  
  17. echo "<br><br>";
  18.  
  19. echo "<Input Type='BUTTON' Name='[b][/b]' Value='[b][/b]' style='width: 50px;' onClick='javascript: smile(\"[b][/b]\");'>";
  20. echo "<Input Type='BUTTON' Name='[u][/u]' Value='[u][/u]' style='width: 50px;' onClick='javascript: smile(\"[u][/u]\");'>";
  21. echo "<Input Type='BUTTON' Name='[i][/i]' Value='[i][/i]' style='width: 50px;' onClick='javascript: smile(\"[i][/i]\");'>";
  22. echo "<Input Type='BUTTON' Name='[email][/email]' Value='[email][/email]' style='width: 48px;' onClick='javascript: smile(\"[email][/email]\");'>";
  23. echo "<Input Type='BUTTON' Name='[url][/url]' Value='[url][/url]' style='width: 60px;' onClick='javascript: smile(\"[url][/url]\");'>";
  24.  
  25. echo "<br><br>";
  26.  
  27.  
  28. echo "<IMG Src='".$img['smiles']."/icon_arrow.gif' onClick='javascript: smile(\":arrow:\")'>";
  29. echo "<IMG Src='".$img['smiles']."/icon_biggrin.gif' onClick='javascript: smile(\":D\");'>";
  30. echo "<IMG Src='".$img['smiles']."/icon_confused.gif' onClick='javascript: smile(\":S\");'>";
  31. echo "<IMG Src='".$img['smiles']."/icon_cool.gif' onClick='javascript: smile(\"8)\");'>";
  32. echo "<IMG Src='".$img['smiles']."/icon_cry.gif' onClick='javascript: smile(\":*(\");'>";
  33.  
  34. echo "<IMG Src='".$img['smiles']."/icon_eek.gif' onClick='javascript: smile(\":shock:\");'>";
  35. echo "<IMG Src='".$img['smiles']."/icon_evil.gif' onClick='javascript: smile(\":evil:\");'>";
  36. echo "<IMG Src='".$img['smiles']."/icon_exclaim.gif' onClick='javascript: smile(\":!:\");'>";
  37. echo "<IMG Src='".$img['smiles']."/icon_frown.gif' onClick='javascript: smile(\"^:(\");'>";
  38.  
  39. echo "<IMG Src='".$img['smiles']."/icon_lol.gif' onClick='javascript: smile(\":lol:\");'>";
  40. echo "<IMG Src='".$img['smiles']."/icon_mad.gif' onClick='javascript: smile(\":x\");'>";
  41. echo "<br>";
  42. echo "<IMG Src='".$img['smiles']."/icon_mrgreen.gif' onClick='javascript: smile(\":mrgreen:\");'>";
  43. echo "<IMG Src='".$img['smiles']."/icon_neutral.gif' onClick='javascript: smile(\":|\");'>";
  44. echo "<IMG Src='".$img['smiles']."/icon_question.gif' onClick='javascript: smile(\":?:\");'>";
  45.  
  46. echo "<IMG Src='".$img['smiles']."/icon_razz.gif' onClick='javascript: smile(\":P\");'>";
  47. echo "<IMG Src='".$img['smiles']."/icon_redface.gif' onClick='javascript: smile(\":oops:\");'>";
  48. echo "<IMG Src='".$img['smiles']."/icon_rolleyes.gif' onClick='javascript: smile(\":roll:\");'>";
  49. echo "<IMG Src='".$img['smiles']."/icon_sad.gif' onClick='javascript: smile(\":(\");'>";
  50. echo "<IMG Src='".$img['smiles']."/icon_smile.gif' onClick='javascript: smile(\":)\");'>";
  51.  
  52. echo "<IMG Src='".$img['smiles']."/icon_surprised.gif' onClick='javascript: smile(\":o\");'>";
  53. echo "<IMG Src='".$img['smiles']."/icon_twisted.gif' onClick='javascript: smile(\":twisted:\");'>";
  54. echo "<IMG Src='".$img['smiles']."/icon_wink.gif' onClick='javascript: smile(\":wink:\");'>";
  55. echo "</Center>";
  56.  
  57. echo "<br><br>Bericht: ";
  58.  
  59. echo "<Textarea Name='content' style='width: 350px; height: 150px;'>";
  60. echo "</Textarea>";
  61.  
  62. echo "<Input Type='SUBMIT' Name='submit' Value='Submit!' style='width: 100px; margin-left: 25px;'margin-right: 25px;'>";
  63. echo "<input type='hidden' name='date' value='date('d-m-y H:i')'>";
  64. echo "<input type='hidden' name='nid' value='".$nid."'>";
  65. echo "<input type='submit' name='submit' value='Submit'>";
  66.  
  67. } else
  68. {
  69.  
  70. if(!IsSet($_POST['poster']) || empty($_POST['poster']))
  71. {
  72. echo "Error!- Geen naam ingevuld!";
  73.  
  74. } else if(!IsSet($_POST['content']) || empty($_POST['content']))
  75. {
  76. echo "Error!- You have to type a message!";
  77. }
  78. }


Het script zelf werkt, het toevoegen van comments dus, maar als ik op een smiley klik, of op de knop , dan worden deze niet toegevoegd in het textvlak...
Iemand van jullie die weet waarom?

2 antwoorden

Gesponsorde links
Offline Ontani - 04/07/2005 01:37 (laatste wijziging 04/07/2005 01:47)
Avatar van Ontani Gouden medailleGouden medailleGouden medailleGouden medaille

-1
<form name="form" ...>

in je javascript staat:

document.form.content.value

document : dit document
form: de naam van het form
content: de naam van het element in het form
value: de waarde (spreekt voor zich)
Offline raintjah - 04/07/2005 01:43
Avatar van raintjah Nieuw lid Thx Ontani, fixed 
Gesponsorde links
Dit onderwerp is gesloten.
Actieve forumberichten
© 2002-2025 Sitemasters.be - Regels - Laadtijd: 0.193s