PDA

View Full Version : Need help with this...


Woodman
11-25-2002, 09:31 AM
Here's my problem:
I have a piece of HTML code directing users to a Java chatroom. Problem is, i need to manually change the name through notepad. What id like to do is to let users enter their name in a text field, & the name would be incorperated into the HTML code. How would i go about doing this? Javascript? HTML? I prefer using Javascript, or just plain HTML, & not CGI, ASP or anything that runs on the server. Here's the code:

<html>
<head><title>Title Tra La La</title></head>
<body bgcolor="#000000" text="#000000" leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>
<APPLET codebase="XXXXXXXX" code="Jirc.class" alt="jirc requires that you have Java enabled. Please enable Java in your browser" width=100% height=99%>
<PARAM name=archive value="jirc.jar">
<PARAM name=nick value="Superman">
<PARAM name=real value="Station Lunatic">
<PARAM name=chan value="#chachacha">
<PARAM name=urlc value="8000ff">
<PARAM name=modc value="0080ff">
<PARAM name=motd value="Welcome to Cha Cha Cha. Type /me for a good time">
</APPLET>
</body>
</html>


The bit id like to let users change through a text field is this line:
<PARAM name=nick value="Superman">



Thanks in advance :)

ConfusedOfLife
11-25-2002, 10:03 AM
Well, I don't understand anything of those params! But here's a sample code that you have a text field and one enters his/her name and it would be displayed in a part of your page.


<b>Welcome</b> <i id="where2Put">&nbsp;</i>

<form name="myForm"
onsubmit="document.getElementById('where2Put').firstChild.nodeValue = this.myText.value; return false;">
<input type="text" name="myText">
<input type="submit">
</form>

Woodman
11-25-2002, 10:57 AM
Well thanks, but it doesnt seem to work on my system or on my webserver.

Could i do something like this?
<PARAM name=nick value=getname()>

Or maybe just put in a variable in the value section?
<PARAM name=nick value=enteredname>

Or could i maybe script an HTML file that gives the entered value to another HTML/javascript file?

Thanks in advance

glenngv
11-25-2002, 11:07 AM
try this:

<html>
<head><title>Title Tra La La</title></head>
<body bgcolor="#000000" text="#000000" leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>
<APPLET name="myApp" codebase="XXXXXXXX" code="Jirc.class" alt="jirc requires that you have Java enabled. Please enable Java in your browser" width=100% height=99% MAYSCRIPT>
<PARAM name=archive value="jirc.jar">
<PARAM name=nick value="Superman">
<PARAM name=real value="Station Lunatic">
<PARAM name=chan value="#chachacha">
<PARAM name=urlc value="8000ff">
<PARAM name=modc value="0080ff">
<PARAM name=motd value="Welcome to Cha Cha Cha. Type /me for a good time">
</APPLET>
<form>
Enter nickname:<br>
<input name="nick">
<input type="button" value="Change Nick" onclick="document.applets['myApp'].nick=this.form.nick.value">
</form>
</body>
</html>

Woodman
11-25-2002, 11:22 AM
Thanks Glenn, but it too doesnt seem to work. The first problem is that the javachat client loads, which it really shouldnt until the user enters his/her name.

Next problem is the name. If i leave it blank & try to enter a name in the field, it doesnt work (giving an error about a blank name). If i put something in the name-value section, then type something in the field, the name in the value section gets used (instead of the entered one).

:(

glenngv
11-25-2002, 11:44 AM
do you have the page online?

try:

<input type="button" value="Change Nick" onclick="document.myApp.nick=this.form.nick.value">

is the nick property of the applet a public property that can be read/set?

you may want to see this http://orgwis.gmd.de/~koch/Java/Script/N3Script.html