sillycheese
01-22-2005, 12:49 PM
I have a javascript code that I need jelp with. I have a log-in script on my home page that will allow users to log-in to a message board, but when they do, it stays within a frame. I want it to target "target='_top' but I don't know how to do it, or where to put the code at.
Here is where think it needs to go:
<input type='submit' name='submit' value='login' class='forminput'>
HERE IS THE FULL CODE:
<HEAD>
<script language="JavaScript">
var COOKIE_NAME = 'myforumiB';
var IB_URL = 'http://mysite.com/myforum.cgi';
function showLogin ()
{
// Read the memberid cookie.
var cookie = readCookie( COOKIE_NAME + 'iBUserName' );
// If cookie exists and has a value, welcome them back.
if (cookie)
{
document.write('<b><center>Welcome Back ' + cookie + '!</center></b>');
}
// If cookie doesn't exist, print login page.
else
{
document.write("<table><form action='" + IB_URL +"' method='post' name='LOGIN' onSubmit='return ValidateForm()'><input type='hidden' name='act' value='Login'><input type='hidden' name='CODE' value='01'><td>Username:<input type='text' size='12' align=right maxlength='64' name='UserName' class='forminput'>Password:<input type='password' align=right size='12' name='PassWord' class='forminput'>
<B><input type='submit' name='submit' value='login' class='forminput'></B>
Remember:<input checked type='checkbox' name='CookieDate' value='1'>Anonymous:<input type='checkbox' name='Privacy' value='1'></td></form></table>");
}
}
// Read cookie function.
function readCookie(name)
{
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++)
{
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
// Checks login form for missing required info.
function ValidateForm()
{
var Check = 0;
if (document.LOGIN.UserName.value == '') { Check = 1; }
if (document.LOGIN.PassWord.value == '') { Check = 1; }
if (Check == 1)
{
alert("Enter Your NAME & PASSWORD You!!!!");
return false;
}
else
{
document.LOGIN.submit.disabled = true;
return true;
}
}
</script>
</HEAD>
<BODY>
<script language="JavaScript">showLogin();</script>
</BODY>
----------------
Please Help
Thanks.
Here is where think it needs to go:
<input type='submit' name='submit' value='login' class='forminput'>
HERE IS THE FULL CODE:
<HEAD>
<script language="JavaScript">
var COOKIE_NAME = 'myforumiB';
var IB_URL = 'http://mysite.com/myforum.cgi';
function showLogin ()
{
// Read the memberid cookie.
var cookie = readCookie( COOKIE_NAME + 'iBUserName' );
// If cookie exists and has a value, welcome them back.
if (cookie)
{
document.write('<b><center>Welcome Back ' + cookie + '!</center></b>');
}
// If cookie doesn't exist, print login page.
else
{
document.write("<table><form action='" + IB_URL +"' method='post' name='LOGIN' onSubmit='return ValidateForm()'><input type='hidden' name='act' value='Login'><input type='hidden' name='CODE' value='01'><td>Username:<input type='text' size='12' align=right maxlength='64' name='UserName' class='forminput'>Password:<input type='password' align=right size='12' name='PassWord' class='forminput'>
<B><input type='submit' name='submit' value='login' class='forminput'></B>
Remember:<input checked type='checkbox' name='CookieDate' value='1'>Anonymous:<input type='checkbox' name='Privacy' value='1'></td></form></table>");
}
}
// Read cookie function.
function readCookie(name)
{
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++)
{
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
// Checks login form for missing required info.
function ValidateForm()
{
var Check = 0;
if (document.LOGIN.UserName.value == '') { Check = 1; }
if (document.LOGIN.PassWord.value == '') { Check = 1; }
if (Check == 1)
{
alert("Enter Your NAME & PASSWORD You!!!!");
return false;
}
else
{
document.LOGIN.submit.disabled = true;
return true;
}
}
</script>
</HEAD>
<BODY>
<script language="JavaScript">showLogin();</script>
</BODY>
----------------
Please Help
Thanks.