...

View Full Version : Show/Hide Help



DigitalBliss
04-10-2005, 04:56 AM
Hey I have a show/hide script here that when I click a link it shows a login form. I made a picture to better explain what I want.

http://starlitdesigns.com/demo.gif

What I want is the login form to be on the right side of the word login instead of under it. Here is my code:



echo"<a href=\"register.php\">Register</a> || <a href=\"javascript:void(0);\" onClick=\"showHide('loginform')\";>Login</a>

<div class=\"hidden\" id=\"loginform\">

<form action=\"account.php?function=login&url=$url\" method=\"post\">

<input class=\"textfield\" type=\"text\" name=\"username\" maxlength=\"25\" size=\"15\">

<input class=\"password\" type=\"password\" name=\"password\" maxlength=\"25\" size=\"15\" value=\"Password\">

<input class=\"submit\" type=\"submit\" value=\"Login\">

</form></div>";

// I spaced it out so everyone can see fine, in actuality the code is bunched up


Someone please help :( :(

DigitalBliss
04-10-2005, 06:37 AM
Maybe I should have put this in the HTML section. My bad.

vwphillips
04-10-2005, 10:17 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

<html>

<head>
<title></title>
<script language="JavaScript" type="text/javascript">
<!--

function PosInput(){
mi=document.getElementById('MyInput').style;
ma=document.getElementById('fred');
mi.top=zxcTop(ma)+'px';
mi.left=zxcLeft(ma)+'px';
}

function zxcLeft(zxc){
zxcObjLeft=zxc.offsetLeft;
while(zxc.offsetParent!=null){
zxcObjParent=zxc.offsetParent;
zxcObjLeft+=zxcObjParent.offsetLeft;
zxc=zxcObjParent;
}
return zxcObjLeft;
}

function zxcTop(zxc){
zxcObjTop=zxc.offsetTop;
while(zxc.offsetParent!=null){
zxcObjParent=zxc.offsetParent;
zxcObjTop+=zxcObjParent.offsetTop;
zxc=zxcObjParent;
}
return zxcObjTop;
}

//-->
</script></head>

<body onload="PosInput" >
Good Evening Anonymous register || Log In <a id="fred"></a>

<div id=MyInput style="position:absolute;width:300px;height:10px;" >
<input name="" size="10" value="User Name">
<input name="" size="10" value="*********">
<input type="button" name="" value="LogIn">
</div>

</body>

</html>

SUPERUSER
04-10-2005, 10:54 AM
Allways follow the KISS principle: :thumbsup:

Use:

document.getElementById("ID_OF_THE_ELEMENT").style.visibility="hidden"
and
document.getElementById("ID_OF_THE_ELEMENT").style.visibility="visible"

Hope that helps. :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum