Click to See Complete Forum and Search --> : This has been answered hundreds....


Burrow
04-18-2003, 10:18 PM
of times in the forum, but I'll ask just once more. :D

Alright, I have gotten my js running pretty well, but I need to pass the variables of my selected function (SOLVED) to the following script.


--------------------------------------------

</head>

<script>
var name= "Unknown";
var type= "Unclassified";
var AccMul= "0";
var AttMul= "0";
var DefMul= "0";
var IntMul= "0";
var PriMul= "0";
var SpeMul= "0";
var VitMul= "0";
var WilMul= "0";

</script>

<body>

<table width="100%" border="0">
<TR>
<TD>

Race:

</TD>
<TD>

<script>

document.writeln(name);

</script>

</TD>
</TR>
<TR>
<TD>

Class:

</TD>
<TD>

<script>

document.writeln(type);

</script>

</TD>
</TR>
<TR>
<TD>

Accuracy Multiplier:

</TD>
<TD>

<script>

document.writeln(AccMul);

</script>

</TD>
</TR>
<TR>
<TD>

Attack Multiplier:

</TD>
<TD>

<script>

document.writeln(AttMul);

</script>

</TD>
</TR>
<TR>
<TD>

Defense Multiplier:

</TD>
<TD>

<script>

document.writeln(DefMul);

</script>

</TD>
</TR>
<TR>
<TD>

Intelligence Multiplier:

</TD>
<TD>

<script>

document.writeln(IntMul);

</script>

</TD>
</TR>
<TR>
<TD>

Pride Multiplier:

</TD>
<TD>

<script>

document.writeln(PriMul);

</script>

</TD>
</TR>
<TR>
<TD>

Speed Multiplier:

</TD>
<TD>

<script>

document.writeln(SpeMul);

</script>

</TD>
</TR>
<TR>
<TD>

Vitality Multiplier:

</TD>
<TD>

<script>

document.writeln(VitMul);

</script>

</TD>
</TR>
<TR>
<TD>

Will Multiplier:

</TD>
<TD>

<script>

document.writeln(WilMul);

</script>

</TD>
</TR>
</TABLE>
</body>

--------------------------------------

Not a fun task, I can get the page to change, so it's not a big deal that I solve this little diddy, but I really just wanted the variables to change the corrosponding script, not the entire page, which is what I'm actually getting. .:Sigh:.


So, that's really it I just want to transfer those variables from my function to this page setup.

Any help is very much appreciated thanks.

Burrow
04-18-2003, 10:31 PM
Oh, and sorry for the horrible scripting and all, it's just a rough draft.

Jona
04-18-2003, 11:23 PM
Not sure what you're asking. You want to send this data to another page? Or do you want to update the text in the tables as the variables change?

Burrow
04-19-2003, 12:23 AM
Both.

I have one page where I have a selection of functions that all contain the same variables, only different values. The page is a second page that shows what the functions contain, what I want is to update the tables there, with the functions from my previous page.

I really don't think that helped to explain anything, but it's my best shot.

If ya can help me, thanks.
If ya can't, don't worry about it.

Any help is appreciated. Thanks.

Jona
04-19-2003, 12:28 AM
My suggestion is use a serverside language to generate your Javascript. Example in PHP:

<html><head>
<?PHP
echo "<script>\n";
echo "document.formName.textboxName.value=".$_POST['textboxName_fromPreviousPage']\n";
echo "</script>";
?>
</head>

This will print the following Javascript:

<script>
document.formName.textboxName.value="the value of the previous page's text box"
</script>

Now, this uses a serverside language, and is only an example. I realize you are using tables not forms, but it's only an example. If you are detemined to use Javascript, you'll have to parse the URL or use a cookie.

Burrow
04-19-2003, 10:53 AM
Alrighty, thanks.

Burrow
04-19-2003, 02:06 PM
heh,

Okay. I've switched my focus onto the actual variables of my main, script no passing of variables to another frame or page or anything.

I've run into a slight problem, I thought that the way I had everything set up, it would work, I was wrong.


The Following is a very, VERY brief version of it.
-------------

<script>

function Race(title,class,AccMul,AttMul)

{
this.title = title;
this.class = class;
this.AccMul = AccMul;
this.AttMul = AttMul;
}


function RaceA1()

{
title = R1.title;
class = R1.class;
AccMul = R1.AccMul;
AttMul = R1.AttMul;
}


function ShowIt()

{
document.writeln(title +"<br>");
document.writeln(class +"<br>");
document.writeln(AccMul +"<br>");
document.writeln(AttMul);
}

R1("Race 1","Class 1","2","2");



</script>


----> A Little further down in the Body


<form>

<input type="radio" name="race" value="Race1" onClick="RaceA1();">Race 1<br><br>

<input type="Submit" name="button1" value="Submit" onSubmit="ShowIt();>

</form>


--------------------------------

Yet when that loads, it shows my variables that were loaded from RaceA1() as Undefined.

I know that it has to do with global variables, and I thought I had it right, because when var is thrown on there it becomes Local if I remember correctly.

If anyone is able to help me with my delimma, where my variables won't reload. It would be of great appreciation.

Thanks.

Burrow
04-19-2003, 05:12 PM
nm,
problem solved.