Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Named Items (confused...?) 1

Status
Not open for further replies.

WhiteTiger

Programmer
Jun 26, 2001
605
US
I have A1 through A10, and I need to pass a number to them...

As of now I'm doing
document.all("A1").value to set the value...

Is there any way in a function that I could NAME what thing I want it to pass my information to?...

I have to pass a number, and I have to pass what should be passed along after that...(confusing part)

function passa1(obj)
{
rate=0.345
document.all("A1").value = obj * rate
addem()

I'm already getting value of 1 textbox...how could I make the area A1 a variable and pass it?...I've tried

function passa1(obj, pass)
{
rate=0.345
document.all(pass).value = obj * rate
addem()

and tried passing "A1" as pass using

onchange="passa1 (M1, A1)" but it doesn't seem to work...any help? Regards,
Anth:cool:ny
----------------------------------------
"You say [red]insanity[/red] like it's a BAD THING!"
 
Here's one thing you could try: pass the value of A1 as a string, like this:
Code:
onchange="passa1 (M1, 'A1')"
If that doesn't work, let us know. There's other things to try.
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
I've tried doing it that way, I always get SOMETHING that messes up that way...like an undefined object...when I have all my objects named, id'd and classified...=P

Is there any other way to do it? Regards,
Anth:cool:ny
----------------------------------------
"You say [red]insanity[/red] like it's a BAD THING!"
 
Anthony, THAT way must be workin nice; culd u plz post here some of ur code (just a problem part) or give us an url 2 check it out & show u da way? regards, vic
 
No URL...it's on an INTRAnet...not internet.

And the problem usally varies all over the place...I could probably post full code for you to see...
Here...=P
Code:
<html>
<head>
<!-- #include virtual=&quot;/common/scripts/db.vbs&quot; -->
<link href=&quot;/common/style.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;>
</head>

<script>
function validate(obj)
{
if(isNaN(obj.value))
alert(&quot;Input Format Error&quot;)
if(isNaN(obj.value))
obj.value=&quot;0&quot;
}

function addem()
{
The1 = parseInt(document.all(&quot;A1&quot;).value)
[b](etc... etc...)[/b]
document.all(&quot;total&quot;).value = The1 + The2 + The3 + The4 + The5 + The6 + The7 + The8 + The9 + The10
}

function passa1(obj)
{
rate=0.345
	document.all(&quot;A1&quot;).value = parseInt(obj) * rate
	addem()
}
[b](etc...goes on w/ function names...passa2, passa3)[/b]

...........on and on down the code after all the junk + tables.........


    <tr>
      <td width=&quot;103&quot;><font FACE=&quot;Arial&quot;><input type=&quot;text&quot; name=&quot;T1&quot; size=&quot;6&quot;></font></td>
      <td width=&quot;98&quot;><font FACE=&quot;Arial&quot;><input type=&quot;text&quot; name=&quot;T2&quot; size=&quot;7&quot;></font></td>
      <td width=&quot;123&quot;><font FACE=&quot;Arial&quot;><input type=&quot;text&quot; name=&quot;T3&quot; size=&quot;5&quot;></font></td>
      <td width=&quot;374&quot;><font FACE=&quot;Arial&quot;><input type=&quot;text&quot; name=&quot;T5&quot; size=&quot;41&quot;></font></td>
      <td width=&quot;167&quot;><font FACE=&quot;Arial&quot;><input type=&quot;text&quot; name=&quot;M1&quot; id=&quot;M1&quot; onchange=&quot;passa1(m1.value) &quot;size=&quot;7&quot;></font></td>
      <td width=&quot;102&quot;>0.345</td>
      <td width=&quot;101&quot;><font FACE=&quot;Arial&quot;><b>$<input type=&quot;text&quot; name=&quot;A1&quot; size=&quot;6&quot; class=&quot;fax&quot; value=&quot;0&quot;></b></font></td>
    </tr>

I'm trying to pass what is entered into M1, etc, to A1, etc...after doing some calculation, and other stuff...
then when that's passed it adds up all the totals of the A's...like a spreadsheet...any help?...I'm going MAD! Regards,
Anth:cool:ny
----------------------------------------
&quot;You say [red]insanity[/red] like it's a BAD THING!&quot;
 
whut the...I previewed the post and it looked find w/ the bold tags...what happened?...watch out for the tags where I was trying to comment stuff Regards,
Anth:cool:ny
----------------------------------------
&quot;You say [red]insanity[/red] like it's a BAD THING!&quot;
 
i'm not shure, Thony, but try the following:
<input type=&quot;text&quot; name=&quot;M1&quot; id=&quot;M1&quot; onchange=&quot;passa1(this.value) &quot;size=&quot;7&quot;>

about ur comments: i think u nested [ b]'s with [ code] tags..

& btw, culd u post here or send me the hole page? vituzz@rambler.ru (w/o ssi)
i cant get the hole picture.. :-( regards, vic
 
Oh, I WAS using this.value to do it...and it worked in frontpage...but I transferred it over to IE 5.0 and it plopped on me...I'll send ya the page... Regards,
Anth:cool:ny
----------------------------------------
&quot;You say [red]insanity[/red] like it's a BAD THING!&quot;
 
got ur email, gettin started.. %-) regards, vic
 
Anthony, i just sent u fixed file, go check ur email.. ;-) regards, vic
 
I apreciate it...thank you...I'm getting to understand a little more about this stuff...=) Regards,
Anth:cool:ny
----------------------------------------
&quot;You say [red]insanity[/red] like it's a BAD THING!&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top