Web Hosting Talk







View Full Version : Simple Java Script Question


jtrovato
12-02-2002, 01:06 PM
I do not want the users to have to click inside the text box/field to place the username and password in.

I want the user to be able to start typing as soon as they go to the site.

User Login (www.classicalevents.com)

I'm not sure what that is called.

Scope?
Blur?

I do forget, thank you all for the input.

sasha
12-02-2002, 01:58 PM
what happens when you put this in the body tag
< body onLoad="document.form1.username.focus();" >

jtrovato
12-02-2002, 02:03 PM
Sasha,

Is that the full tag?

Can you put that in tags, so I can see the whole thing.

That should work for what I need it to do.

sasha
12-02-2002, 02:07 PM
onLoad="document.form1.username.focus();"
that is it. nothing else. Just stick it inside the <body>

jtrovato
12-02-2002, 02:09 PM
cool

thank you, I will try now

You can see for yourself if it worked.

www.classicalevents.com

sasha
12-02-2002, 02:11 PM
heh it did not

inside the body like this

<body RIGHT HERE >

jtrovato
12-02-2002, 02:13 PM
that will not work for me, Below is the full file. Unless you think of a different way. I call an include file which has the body tags in there but it's used for different files that don't have this form in it??

Bad programming??? maybe


<?php
// *******************************************************************************************************
// (index.php)
// Created by John Trovato
// Start date: July 2002
//
// Purpose: This is the start of the application
// Checks to see if there is a session started already if so let the user know this
// *******************************************************************************************************
include ("/home/classica/public_html/configuration/settings.php");
include ("/home/classica/public_html/configuration/functions.php");
include ("/home/classica/public_html/configuration/header.php");

if (session_is_registered("status")) // check to see if a session was started
session_destroy();

// onLoad="document.form1.username.focus();"

echo "<table><tr><td>";
echo "<form action=\"configuration\checklogin.php\" method=post enctype=\"application/x-www-form-urlencoded\" autocomplete=off name=form1 target=_self>";
echo "<table width=87>";
echo "<tr>";
echo "<td>Username</td>";
echo "<td>";
echo "<input name=username type=text id=username size=15 maxlength=15><br>";
echo "</td></tr>";
echo "<tr>";
echo "<td>Password</td>";
echo "<td>";
echo "<input name=password type=password id=password size=15 maxlength=15>";
echo "</td>";
echo "</tr>";
echo "<tr><td colspan=2 align=center>";
echo "<input name=OK type=Submit value=\"Log In\">";
echo "</td>";
echo "</form></table>";
echo "<br><br>";
echo "<font size=4>** WARNING!! **</font><br><br>All activity on this site is monitored and recorded. Only Authorized users may use this site.";
echo "<br><br><a href=mailto:john@inofficenetworks.com>Forget your username or password email web master</a><br>";
echo "<br>** This application is to be used with IE6.0 on a Microsoft Windows platform.";
echo "</td></tr></table>";
?>


Thanks

sasha
12-02-2002, 02:18 PM
Your body tag is in here ? right?
/home/classica/public_html/configuration/header.php

so you could replace it with <body onLoad="<?=$loadJS ?>" >

and then just above the
include ("/home/classica/public_html/configuration/header.php");
line
$loadJS = 'document.form1.username.focus();' ;