Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add Text in textarea problem

Status
Not open for further replies.

sammol

MIS
Oct 10, 2001
20
HK
Before I am using a php message broad as my guest book and it work fine after much modification. But now I need to migrate it to ASP but I cannot get the Add smiley work. I know it call a function and add test to testarea. But it is not work. Can someone help me find out what problem I suffered?

PHP code
<?
include (&quot;config.php&quot;)
?>
<html>
<head>
<title>JevonTech Guestbook</title>
</head>
<script language=&quot;javascript&quot;>
function AddText(NewCode) {
document.Jpmaster.msg.value+=NewCode;
document.Jpmaster.msg.focus();
}
function smile(){
AddTxt=&quot; :)&quot;;
AddText(AddTxt);
}
function sad(){
AddTxt=&quot; :(&quot;;
AddText(AddTxt);
}
function smilehard(){
AddTxt=&quot; ;D&quot;;
AddText(AddTxt);
}
function laugh(){
AddTxt=&quot; :D&quot;;
AddText(AddTxt);
}
function tongue(){
AddTxt=&quot; :p&quot;;
AddText(AddTxt);
}
function shocked(){
AddTxt=&quot; :eek:&quot;;
AddText(AddTxt);
}
function cool(){
AddTxt=&quot; 8)&quot;;
AddText(AddTxt);
}
function rolleyes(){
AddTxt=&quot; =)&quot;;
AddText(AddTxt);
}
function wink(){
AddTxt=&quot; ;)&quot;;
AddText(AddTxt);
}
function embarassed(){
AddTxt=&quot; :-[&quot;;
AddText(AddTxt);
}
</script>
<style><!-- a{text-decoration:underline; font-weight: bold; font-size: 8.0pt; font-family:Tahoma}, a:hover{color:#395480;}, a:link{color:#748db5;}, a:visited{color:#748db5;}, a:hover{color:#395480;}
.whatever{ font-family: Verdana,Sans; color: #ffffff; font-size: 8.0pt; font-weight: bold; border: 1 solid #000000; background-color: #5582b0;}-->
</style>
<body bgcolor=&quot;<? echo $pagebgc?>&quot; marginwidth=&quot;10&quot; marginheight=&quot;10&quot; topmargin=&quot;10&quot; leftmargin=&quot;10&quot; rightmargin=&quot;10&quot; bottommargin=&quot;10&quot;>
<table style=&quot;border:1 solid black;&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; bgcolor=&quot;#000000&quot;>
<tr>
<td>
<table width=&quot;450&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot;>
<tr>
<td bgcolor=&quot;#476F97&quot; width=&quot;10&quot; height=&quot;20&quot;></td>
<td bgcolor=&quot;#476F97&quot; width=&quot;440&quot; height=&quot;20&quot; align=&quot;left&quot;><font face=&quot;Tahoma&quot; size=&quot;2&quot; color=&quot;#ffffff&quot;>
<b>Sign My Guestbook!</b></font></td>
<tr>
<td bgcolor=&quot;#000000&quot; width=&quot;450&quot; height=&quot;1&quot; colspan=&quot;2&quot;></td>
</tr>
<tr>
<td bgcolor=&quot;#D0D7E0&quot; width=&quot;450&quot; height=&quot;4&quot; colspan=&quot;2&quot;></td>
</tr>
<tr>
<td bgcolor=&quot;#000000&quot; width=&quot;450&quot; height=&quot;1&quot; colspan=&quot;2&quot;></td>
</tr>
<tr>
<td bgcolor=&quot;#eeeeee&quot; width=&quot;10&quot;></td>
<td bgcolor=&quot;#eeeeee&quot; width=&quot;440&quot;>
<FORM name=Jpmaster action=&quot;guestbook.php&quot; method=post>
<br>
<font face=&quot;Tahoma&quot; size=&quot;2&quot;>
<b>Name:</b><br>
<input name=&quot;nick&quot; maxlength=&quot;30&quot;><br><br>
<b>Email:</b><br>
<input name=&quot;email&quot; maxlength=&quot;40&quot;><br><br>
<b>URL:</b><br>
<input name=&quot;url&quot; value=&quot; maxlength=&quot;70&quot;><br><br>
<b>Add Smileys:</b>&nbsp;<a href=javascript:smile()><img src=&quot;images/smile.gif&quot; border=&quot;0&quot;></a>&nbsp;<a href=javascript:laugh()><img src=&quot;images/laugh.gif&quot; border=&quot;0&quot;></a>&nbsp;<a href=javascript:wink()><img src=&quot;images/wink.gif&quot; border=&quot;0&quot;></a>&nbsp;<a href=javascript:smilehard()><img src=&quot;images/smilehard.gif&quot; border=&quot;0&quot;></a>&nbsp;<a href=javascript:embarassed()><img src=&quot;images/embarassed.gif&quot; border=&quot;0&quot;></a>&nbsp;<a href=javascript:tongue()><img src=&quot;images/tongue.gif&quot; border=&quot;0&quot;></a>&nbsp;<a href=javascript:sad()><img src=&quot;images/sad.gif&quot; border=&quot;0&quot;></a>&nbsp;<a href=javascript:shocked()><img src=&quot;images/shocked.gif&quot; border=&quot;0&quot;></a>&nbsp;<a href=javascript:cool()><img src=&quot;images/cool.gif&quot; border=&quot;0&quot;></a>&nbsp;<a href=javascript:rolleyes()><img src=&quot;images/rolleyes.gif&quot; border=&quot;0&quot;></a><br>
<script language=&quot;javascript&quot;>
if(!((navigator.appName == &quot;Netscape&quot; && navigator.appVersion.charAt(0) >= 4) || (navigator.appName == &quot;Microsoft Internet Explorer&quot; && navigator.appVersion.charAt(0) >= 4) || (navigator.appName == &quot;Opera&quot; && navigator.appVersion.charAt(0) >= 4))) {
document.write(&quot;<font size=1 color=red>** browser not compatible with these buttons</font>&quot;); }
</script>
<br>
<b>Message:</b><br>
<textarea name=&quot;msg&quot; wrap=virtual cols=&quot;40&quot; rows=&quot;5&quot;></textarea><br><br>
<input class=&quot;whatever&quot; type=&quot;submit&quot; value=&quot;Sign Guestbook!&quot;><br><br>
</FORM>
</td>
</tr>
</table>
</td>
</tr>
</table>

</body>
</html>
 
Here is the ASP code

<TITLE>title</TITLE>
<META HTTP-EQUIV=&quot;Content-Type&quot; CONTENT=&quot;text/html; charset=big5&quot;>
<style type=&quot;text/css&quot;>
<!--
td {font-family:Verdana;font-size:10pt;}
//-->
</style>
<STYLE>
.800 { background-color: #003366; scrollbar-track-color: #003366; scrollbar-arrow-color: #ffffff; scrollbar-base-color: #093D8F; scrollbar-face-color: #B9D0EB; scrollbar-highlight-color: #093D8F; scrollbar-shadow-color: #093D8F;}
.input {color: #0C00A4; background-color: #AFD1FE; font-size: 12px;}
</STYLE>
<script language=&quot;JavaScript&quot;>
function AddText(NewCode) {
document.form1.txtmessage.value+=NewCode;
document.form1.txtmessage.focus();
}
function smile(){
AddTxt=&quot; :)&quot;;
AddText(AddTxt);
}
function sad(){
AddTxt=&quot; :(&quot;;
AddText(AddTxt);
}
function smilehard(){
AddTxt=&quot; ;D&quot;;
AddText(AddTxt);
}
function laugh(){
AddTxt=&quot; :D&quot;;
AddText(AddTxt);
}
function tongue(){
AddTxt=&quot; :p&quot;;
AddText(AddTxt);
}
function shocked(){
AddTxt=&quot; :eek:&quot;;
AddText(AddTxt);
}
function cool(){
AddTxt=&quot; 8)&quot;;
AddText(AddTxt);
}
function rolleyes(){
AddTxt=&quot; =)&quot;;
AddText(AddTxt);
}
function wink(){
AddTxt=&quot; ;)&quot;;
AddText(AddTxt);
}
function embarassed(){
AddTxt=&quot; :-[&quot;;
AddText(AddTxt);
}
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
Sub button2_onclick
window.location.href = &quot;javascript:history.back();&quot;
End Sub
</script>
<FORM name=form1 action=&quot;Message_main2.asp&quot; method=post>
<TABLE width=&quot;100%&quot;>
<TR bgcolor='#009900'>
<TD bgcolor=&quot;#6D66CC&quot;> <font color=white face=&quot;Arial&quot; size=&quot;2.5&quot;><Strong>Forum
</Strong> - Write Content </font> </TD>
</TR>
<TR bgcolor=&quot;#66cc66&quot;>
<TD bgcolor=&quot;#8F89D8&quot;><font color=white face=&quot;Arial&quot; size=&quot;2.5&quot;><b>Author</b></font>&nbsp;&nbsp;
<input type=&quot;text&quot; name=txtpostby size=&quot;40&quot; maxlenght=&quot;150&quot; maxlength=&quot;40&quot; >
</td>
</TR>
<TR bgcolor='#66cc66'>
<TD bgcolor=&quot;#8F89D8&quot;><font color=white face=&quot;Arial&quot; size=&quot;2.5&quot;><b>Content</b>
(HTML allowed)</font></td>
</TR>
<TR>
<TD><center>
<b>Add Smiley:</b>&nbsp;<a href=javascript:smile()><img src=&quot;images/smile.gif&quot; border=&quot;0&quot;></a>&nbsp;<a href=javascript:laugh()><img src=&quot;images/laugh.gif&quot; border=&quot;0&quot;></a>&nbsp;<a href=javascript:wink()><img src=&quot;images/wink.gif&quot; border=&quot;0&quot;></a>&nbsp;<a href=javascript:smilehard()><img src=&quot;images/smilehard.gif&quot; border=&quot;0&quot;></a>&nbsp;<a href=javascript:embarassed()><img src=&quot;images/embarassed.gif&quot; border=&quot;0&quot;></a>&nbsp;<a href=javascript:tongue()><img src=&quot;images/tongue.gif&quot; border=&quot;0&quot;></a>&nbsp;<a href=javascript:sad()><img src=&quot;images/sad.gif&quot; border=&quot;0&quot;></a>&nbsp;<a href=javascript:shocked()><img src=&quot;images/shocked.gif&quot; border=&quot;0&quot;></a>&nbsp;<a href=javascript:cool()><img src=&quot;images/cool.gif&quot; border=&quot;0&quot;></a>&nbsp;<a href=javascript:rolleyes()><img src=&quot;images/rolleyes.gif&quot; border=&quot;0&quot;></a><br>
<script language=&quot;javascript&quot;>
if(!((navigator.appName == &quot;Netscape&quot; && navigator.appVersion.charAt(0) >= 4) || (navigator.appName == &quot;Microsoft Internet Explorer&quot; && navigator.appVersion.charAt(0) >= 4) || (navigator.appName == &quot;Opera&quot; && navigator.appVersion.charAt(0) >= 4))) {
document.write(&quot;<font size=1 color=red>** browser not compatible with these buttons</font>&quot;); }
</script>
<textarea name=&quot;txtmessage&quot; wrap=virtual cols=&quot;80&quot; rows=&quot;10&quot;></textarea>
</center>
</TD>
</TR>
</TABLE>
<div align=&quot;center&quot;>
<INPUT type=&quot;Submit&quot; value=&quot;Write&quot; name=button1>
<input type=&quot;button&quot; name=&quot;back&quot; value=&quot;©¹«e¤@­¶&quot; onClick=&quot;history.back()&quot;>
<br>
</div>
<hr>
<br>
</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top