View Full Version : not sure if this is possible...


burningstars
07-05-2003, 11:50 PM
Ok this is the code I have


<HEAD>

<SCRIPT LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Original: John Hobbs (jaalibbrandl@hotmail.com) -->
<!-- Web Site: http://jsquared.faithweb.com -->
<!-- Check out: http://jsquared.faithweb.com/cookie/fortune.html for a neat layout -->

<!-- Begin
var quotes = new Array(12) //Add your quotes below
quotes[0]="Its better to be hated for who you are than to be loved for who you are not.";
quotes[1]="Friends are those who walk in when the rest of the world walks out.";
quotes[2]="Never look down on anyone unless your helping them up.";
quotes[3]="Last night I dreamed I ate a ten pound marshmallow and when I woke up the pillow was gone.";
quotes[4]="The better we feel about ourselves the less we have to knock someone else down to feel tall";
quotes[5]="If you want the rainbow then you have to put up with the rain.";
quotes[6]="Your luck is about to change.";
quotes[7]="Things will soon go your way.";
quotes[8]="Stand up for what is right even if your standing alone.";
quotes[8]="One day your whole life is going to flash in front of you make it worth watching.";
quotes[9]="A friend will bail you out of jail a best friend will be there with you saying ^^^^ that was fun.";
quotes[10]="Shoot for the moon even if u miss youll land among the stars.";
quotes[11]="You havent failed until you give up.";
quotes[12]="A ship in harbour is safe but that is not what ships are built for.";
quotes[13]="In every life there is at least one unforgettable heartbreak.";
quotes[14]="Enjoy the little things for one day you will look back on your life and realize they were the big things.";
quotes[15]="Sometimes the person you really need is the one you didnt think you wanted.";
quotes[16]="Your braver than you believe stronger than you see and smarted than you think.";
quotes[17]="Love is a gift not an obligation.";
quotes[18]="Sometimes what we need isnt what we want.";
quotes[19]="A true friend is someone who can see the truth and pain in you when your fooling everyone else.";
quotes[20]="Sometimes you have to let go to see if there even is anything worth holding on to.";
quotes[21]="You long for that certain someone. Dont fret they are out there all you have to do is open your heart.";

function fortune() {
var rand_int = Math.floor(Math.random()*12); //Get a number for picking the quote
document.all.myspan.innerHTML=(quotes[rand_int]); //Put the quote in the box
}
function numberstoo() {
var space = (' ') //Spacer for between numbers
var rand_inta = Math.floor(Math.random()*100); //Get first number
var rand_intb = Math.floor(Math.random()*100); //Get second number
var rand_intc = Math.floor(Math.random()*100); //Get third number
var rand_intd = Math.floor(Math.random()*100); //Get fourth number
var rand_inte = Math.floor(Math.random()*100); //Get fifth number
document.all.myspant.innerHTML=(rand_inta+space+ra nd_intb+space+rand_intc+space+rand_intd+space+rand _inte); //Print it all into the second box
}
// End -->
</script>

</HEAD>

<BODY bgcolor="#000000"><font face="arial" color="#cc9999" size="1">

<div align="center">
<a onclick="fortune()"><b>Click <u>here</u> for your fortune:</b></a><br>
<span id="myspan"></span>
<p>
<p>
<a onclick="numberstoo()"><b>Click <u>here</u> for your numbers:</b><br>
</a><span id="myspant"></span>
</div>


What i want to know if I can do or not is the last part where it says:

<a onclick="fortune()"><b>Click <u>here</u> for your fortune:</b></a><br>
<span id="myspan"></span>
<p>
<p>
<a onclick="numberstoo()"><b>Click <u>here</u> for your numbers:</b><br>
</a><span id="myspant"></span>

is there a way that i could make it so when you click it will send the random fortune/numbers to an input field type of thing like the way it is on my other page sort of how when you press the button it will send some information to another field (heres (http://www.hostultra.com/~frozentears/lovetest.html) the link) thanks for any help you offer! :)