Newbie question: getting visitor's info

  • Thread starter Bernhard Enders
  • Start date
B

Bernhard Enders

Hi!

I'm building a web page and I need some user (student) details to
construct the page based on information like student first name, last
name, student ID, and class. What are the best way to accomplish this
with javascript? Popup? Pass the information from one html (with
forms) to another (the target)? How can I do this? I'm not interested
in severeal prompts. Thanks in advance,

Bernhard.
 
S

Stewart Gordon

Andrew Thompson wrote:

[1] Pop-ups are becoming extinct as browser manufacturers
respond to the requests of their users and remove those
irritating things. They can be re-enabled by the user, but
that is irrelevant, since, once installed, many users* are
absolutely perplexed as to why 'clicking the link does nothing'
<snip>

Most popup killers I've come across let through popups that appear on
click rather than on load.

But yes, you shouldn't use popups just for the sake of it, e.g. when you
might as well put the form directly on the main page.

Stewart.
 
B

Bernhard Georg Enders

Hi!

I'm building a web page and I need some user (student) details to
construct the page based on information like student first name, last
name, student ID, and class. What are the best way to accomplish this
with javascript? Popup? Pass the information from one html (with
forms) to another (the target)? How can I do this? I'm not interested
in severeal prompts. Thanks in advance,

Bernhard.

Just for clarifying my intention, please consider the following simple
example where I've got UNDEFINED for "document.write(StName)" command.
Thanks again,

Bernhard.

---------------- MAIN.HTML (opener) ----------------
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
var StName;
function OpenLoginWindow() {
LoginWindow = window.open ('Login.html','login', 'status=no,
scrollbars=no, resizable=yes, width=250, height=150');
}
// -->
</SCRIPT>
</HEAD>
<BODY onLoad="OpenLoginWindow()">
<SCRIPT LANGUAGE="JavaScript">
<!--
document.write(StName);
// -->
</SCRIPT>
</BODY>
</HTML>
---------------- LOGIN.HTML (opened) ----------------
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function setVars (form) {
var TestVar = orm.Name.value;
opener.StName = TestVar;
self.close();
}
// -->
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="Student" ACTION="" METHOD="GET">
<TABLE>
<TR>
<TH align=right nowrap>NAme:</TH>
<TD><INPUT type=text name=Name value="">
</TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
 
R

Robert

Do it like yahoo does with it email client.

1) First page has a form with userid and password.
2) Second has whatever you are doing.

Just for clarifying my intention, please consider the following simple
example where I've got UNDEFINED for "document.write(StName)" command.
Thanks again,

Bernhard.

I have made more comments in your main.html file. Robert
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<title>Is required</title>
<SCRIPT LANGUAGE="JavaScript">
// You don't need those funny characters any more.
// They were for netscape 1.

var StName;

/* Please limit your lines to 72 characters when
posting. */

function OpenLoginWindow() {
LoginWindow = window.open (
'Login.html','login',
'status=no, scrollbars=no, resizable=yes, width=250, height=150');
}

</SCRIPT>
</HEAD>
<!-- onload handler gets envoked with the document
is completely loaded. Notice, the document.write
comes before the onload. -->
<BODY onLoad="">
<SCRIPT LANGUAGE="JavaScript">
// window.open is asyncronouse so calling it
// here will not work either.

// You could user innerHTML to modify the text
// from logon.html

StName = prompt("Please enter your user id:");
document.write(StName);

</SCRIPT>
</BODY>
</HTML>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top