Click to See Complete Forum and Search --> : use applet with javascript in textarea


ken2010
06-03-2010, 07:29 AM
+++++++++++++++++++++++APPLET+++++++++++++++++++++++++++
import java.applet.*;
import java.awt.*;

public class Colors extends Applet{

Font f1;
public void init(){
f1=new Font("Helvetica", Font.BOLD+Font.ITALIC, 20);
}
public void paint(Graphics g){

g.setFont(f1);
g.setColor(Color.blue);
g.drawString("FIRSTNAME", 50, 100);
}
}
+++++++++++++++++++++++APPLET+++++++++++++++++++++++++++++

+++++++++++++++++++++JAVASCRIPT+++++++++++++++++++++++++
<HTML><HEAD>
<script type="text/javascript">
var nFirstName
function calc() {
df=document.myform;
df.add.onclick=function() {
nFirstName=df.firstname.value;
df.nResult.value= nFirstName
df.nResult.className='vr';
}
}
if(window.addEventListener){
window.addEventListener('load',calc,false);
}
else {
if(window.attachEvent){
window.attachEvent('onload',calc);
}
}
</script>
+++++++++++++++++++++++JAVASCRIPT++++++++++++++++++++++

++++++++++++++++++++++HTML+++++++++++++++++++++++++++++
</head>

<body>
<applet code="Color.class"></applet>
<form action="" name="myform" method="post" enctype="text/plain" onSubmit="document.myform.action = 'maito:' +document.myform.address.value">
<DIV>
<center>FIRSTNAME:<input type="text" name="firstname"></center><br>
<label></label><textarea name="nResult" cols="60" rows="15" readonly="readonly"></textarea><br>
<input type="button" name="add" value="result">
<input type="reset" name="reset" value="clear">
</TABLE>
</div>
</form>

</body>
</html>
++++++++++++++++++++++++++++HTML+++++++++++++++++++++++
tHANKS FOR THE HELP. please this is what i need to do. I want to make the applet appear in the textarea at the front of the firstname.

criterion9
06-03-2010, 07:44 AM
http://java.sun.com/applets/
http://java.sun.com/docs/books/tutorial/deployment/applet/html.html