PLA Forums

Other Stuff That Has Little To Do With PLA => Techinical Shit => Technical Support => Topic started by: BrianOlsen on December 23, 2006, 12:11:33 PM

Title: JavaScript Issue
Post by: BrianOlsen on December 23, 2006, 12:11:33 PM
I am using this JS to insert a value into a form text box, it works great but when someone clicks another link, it changes the form text box to the newly clicked value. I would like it to append to the existing value.

Eg; it inserts "one" and when i click on two, it changes "one" to "two", i would like it to show "one two"

Code: [Select]
<script language='javascript' type="text/javascript">
<!-- Hide script from older browsers
        function cc(val) {
           document.form1.cc.value = val
        }
// End hiding script from older browsers -->
</script>
Title: Re: JavaScript Issue
Post by: Reverend Greed on December 23, 2006, 02:06:58 PM
I am using this JS to insert a value into a form text box, it works great but when someone clicks another link, it changes the form text box to the newly clicked value. I would like it to append to the existing value.

Eg; it inserts "one" and when i click on two, it changes "one" to "two", i would like it to show "one two"

Code: [Select]
<script language='javascript' type="text/javascript">
<!-- Hide script from older browsers
        function cc(val) {
           document.form1.cc.value = val
        }
// End hiding script from older browsers -->
</script>


Change this line:

Code: [Select]
document.form1.cc.value = val
To this:

Code: [Select]
document.form1.cc.value += val
Title: Re: JavaScript Issue
Post by: BrianOlsen on December 23, 2006, 02:34:11 PM
That worked.  Thanks!!!!!

Title: Re: JavaScript Issue
Post by: BrianOlsen on December 23, 2006, 02:41:06 PM
Can you include JS, html, and php into one file?  I want my site to have a login that keeps the user logged in the entire time.  Where would I start?

I use the forum used here but I just converted the database from invision to smf.
Title: Re: JavaScript Issue
Post by: Reverend Greed on December 23, 2006, 02:55:56 PM
Can you include JS, html, and php into one file?  I want my site to have a login that keeps the user logged in the entire time.  Where would I start?

I use the forum used here but I just converted the database from invision to smf.

1.  Yes.

2.  You'll need to use SSI......and what's nice is that the commands are already in place.  For example:

ssi_welcome();
ssi_login();

This will automatically create the login and welcome portion.  You just need to place it in your php file (index.php or whatever)
Title: Re: JavaScript Issue
Post by: BrianOlsen on December 23, 2006, 03:15:55 PM
Ok this is what I did.

Code: [Select]
<?php
include './forum/SSI.php';

ssi_welcome();
ssi_login();
?>


But I want the login to be nice looking with a blue border, red lettering, and whatnot.  How do i do this?
Title: Re: JavaScript Issue
Post by: Reverend Greed on December 23, 2006, 03:31:05 PM
Ok this is what I did.

Code: [Select]
<?php
include './forum/SSI.php';

ssi_welcome();
ssi_login();
?>


But I want the login to be nice looking with a blue border, red lettering, and whatnot.  How do i do this?

Use CSS.  Then reference the style sheet in the <head> portion within your php code.
Title: Re: JavaScript Issue
Post by: BrianOlsen on December 23, 2006, 04:06:05 PM
I'll be honest, I don't know how to do that.  Will you show me?
Title: Re: JavaScript Issue
Post by: Reverend Greed on December 23, 2006, 06:23:29 PM
I'll be honest, I don't know how to do that.  Will you show me?

Okay, do this:

PHP code and name the file whatever suits you ending with *.php.

Code: [Select]
<?php
include './forum/SSI.php';
echo 
'<head><link rel="stylesheet" type="text/css" href="login.css" /></head><body>
<fieldset>
<legend>Go directly to the <a href="/forum">forum</a>.</legend>'
;
ssi_welcome();
ssi_login();
echo 
'</fieldset> </body>';
?>

And here's the CSS code that should be named "login.css" in order for your PHP file to pick it up. 

Code: [Select]
input[type="submit"]{
margin-left: 5em;
clear: both;
color: #000;
background: #fb0;
border: 2px #9cf outset
}

fieldset
{
border: #26a solid 1px;
width: 20em
}

legend
{
background: #fb0;
border: #26a solid 1px;
padding: 1px 10px
}

label
{
width: 4em !important;
float: left !important;
text-align: right !important;
margin: 0 1em 10px 0 !important;
clear: both !important;
}

input[id="user"], input[id="passwrd"]
{
float: left;
margin-bottom: 10px;
color: #26a;
background: #feb;
border: #26a solid 1px
}

The way it's written - the CSS file needs to be in the same directory as the PHP file.  I currently set the hyper reference towards whatever directory you place it in. 

Hope this helps.
Title: Re: JavaScript Issue
Post by: BrianOlsen on December 23, 2006, 10:21:26 PM
Dude!  This is exactly want I wanted and it works beautifully, you're a ninja.  Can I paypal you some cash for your time?
Title: Re: JavaScript Issue
Post by: Reverend Greed on December 23, 2006, 10:41:13 PM
Dude!  This is exactly want I wanted and it works beautifully, you're a ninja.  Can I paypal you some cash for your time?

No.  Go donate to your local battered women's shelter.
Title: Re: JavaScript Issue
Post by: BrianOlsen on December 26, 2006, 02:26:40 PM
Ok I did that.  I used paypal to donate $20.00 to an online organization.