I am new to javascript and running in to some problems

F

Frank H. Shaw

It has come to my understanding javascript runs when page is first opens this
would be a problem if I use javascript in what I am trying to do: I need to
understand how this can be stoped so javascript runs when the user selects
the submit button which happens afterr the user has selected a option in the
two radiobuttons that ask the user to choices pricing by each or pricing by
dozen. The logic which parses the action of the radiobutton is inside a form
that is contained in a table the form is used to send standard information to
paypal server but what changes is the item number and price which is barried
in some hidden input fields inside the form: I would be using some IF ELSE
ENDIF logic around the two lines of HTML that changed depending on wich
option the user selected in the radiobutton - since it has come to my
understanding that javascript runs when page opens javascript my not be the
answer and I might have to use PHP unstead But if PHP is the answer then I
need it to run when information is being sent to paypal so this means it has
to happen at the client side like HTML does. I have pasted at the bottom of
this message the form code which is used to send up to paypal:

I have created several threads around my problem and questions previous to
this posting you can get all the treads just look for my name Frank H. Shaw

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr"
method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="(e-mail address removed)">
<input type="hidden" name="item_name" value="Pro Style ATF Ankle Brace with
Universal Fit">
<input type="hidden" name="item_number" value="212-E">
<input type="hidden" name="amount" value="20.95">
<input type="hidden" name="return"
value="http://www.skolsportsshop.com/success.htm">
<input type="hidden" name="cancel_return"
value="http://www.skolsportsshop.com/cancel.htm">
<input type="hidden" name="currency_code" value="USD">
<input TYPE="image" SRC="https://www.paypal.com/images/sc-but-03.gif"
NAME="submit0"alt="Make payments with PayPal - it's fast, free and secure!"
width="124" height="26">
<input type="hidden" name="add" value="1">
</form>

As you can see the two lines need to change depending on the radiobutton
action taken by the user the following two lines from:

<input type="hidden" name="item_number" value="212-E">
<input type="hidden" name="amount" value="20.95">

As you can see the two lines need to change depending on the radiobutton
action taken by the user the following two lines To:

<input type="hidden" name="item_number" value="212-D">
<input type="hidden" name="amount" value="225.00">

I figured this logic could be done by using a IF ELSE ENDIF around the four
lines of code and done in javascript by building a conditional exprersion for
the IF based on the action of the radiobutton my conditional expersion would
look something like this (amount[1].checked) or might be the following might
work also (amount[1].value = 20.95) the amount is the name properity of
both the radiobuttons because they are in the same group [1] is the first
item in the array and value or checked is the actual properity being tested
in the IF - what comes before the amount I am not shure of if anything but
remember the radiobutton sits in side a table and is in one of the cells of
the table.

THANKS
 
M

Murray

Too many words.

Try to explain what you want in 50 words or less. It sounds like you want
some javascript to run after the form is submitted?

--
Murray
============

Frank H. Shaw said:
It has come to my understanding javascript runs when page is first opens
this
would be a problem if I use javascript in what I am trying to do: I need
to
understand how this can be stoped so javascript runs when the user selects
the submit button which happens afterr the user has selected a option in
the
two radiobuttons that ask the user to choices pricing by each or pricing
by
dozen. The logic which parses the action of the radiobutton is inside a
form
that is contained in a table the form is used to send standard information
to
paypal server but what changes is the item number and price which is
barried
in some hidden input fields inside the form: I would be using some IF ELSE
ENDIF logic around the two lines of HTML that changed depending on wich
option the user selected in the radiobutton - since it has come to my
understanding that javascript runs when page opens javascript my not be
the
answer and I might have to use PHP unstead But if PHP is the answer then I
need it to run when information is being sent to paypal so this means it
has
to happen at the client side like HTML does. I have pasted at the bottom
of
this message the form code which is used to send up to paypal:

I have created several threads around my problem and questions previous to
this posting you can get all the treads just look for my name Frank H.
Shaw

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr"
method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="(e-mail address removed)">
<input type="hidden" name="item_name" value="Pro Style ATF Ankle Brace
with
Universal Fit">
<input type="hidden" name="item_number" value="212-E">
<input type="hidden" name="amount" value="20.95">
<input type="hidden" name="return"
value="http://www.skolsportsshop.com/success.htm">
<input type="hidden" name="cancel_return"
value="http://www.skolsportsshop.com/cancel.htm">
<input type="hidden" name="currency_code" value="USD">
<input TYPE="image" SRC="https://www.paypal.com/images/sc-but-03.gif"
NAME="submit0"alt="Make payments with PayPal - it's fast, free and
secure!"
width="124" height="26">
<input type="hidden" name="add" value="1">
</form>

As you can see the two lines need to change depending on the radiobutton
action taken by the user the following two lines from:

<input type="hidden" name="item_number" value="212-E">
<input type="hidden" name="amount" value="20.95">

As you can see the two lines need to change depending on the radiobutton
action taken by the user the following two lines To:

<input type="hidden" name="item_number" value="212-D">
<input type="hidden" name="amount" value="225.00">

I figured this logic could be done by using a IF ELSE ENDIF around the
four
lines of code and done in javascript by building a conditional exprersion
for
the IF based on the action of the radiobutton my conditional expersion
would
look something like this (amount[1].checked) or might be the following
might
work also (amount[1].value = 20.95) the amount is the name properity of
both the radiobuttons because they are in the same group [1] is the first
item in the array and value or checked is the actual properity being
tested
in the IF - what comes before the amount I am not shure of if anything but
remember the radiobutton sits in side a table and is in one of the cells
of
the table.

THANKS
 
S

Steve Easton

Javascript only runs when the page is opened if you tell it to, using an onload statement in the
body tag or within the script tags in the page.

To make javascript "fire" due to an "event" contained within a form you need to use an onchange or
onselect event.


--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
........................with a computer

Frank H. Shaw said:
It has come to my understanding javascript runs when page is first opens this
would be a problem if I use javascript in what I am trying to do: I need to
understand how this can be stoped so javascript runs when the user selects
the submit button which happens afterr the user has selected a option in the
two radiobuttons that ask the user to choices pricing by each or pricing by
dozen. The logic which parses the action of the radiobutton is inside a form
that is contained in a table the form is used to send standard information to
paypal server but what changes is the item number and price which is barried
in some hidden input fields inside the form: I would be using some IF ELSE
ENDIF logic around the two lines of HTML that changed depending on wich
option the user selected in the radiobutton - since it has come to my
understanding that javascript runs when page opens javascript my not be the
answer and I might have to use PHP unstead But if PHP is the answer then I
need it to run when information is being sent to paypal so this means it has
to happen at the client side like HTML does. I have pasted at the bottom of
this message the form code which is used to send up to paypal:

I have created several threads around my problem and questions previous to
this posting you can get all the treads just look for my name Frank H. Shaw

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr"
method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="(e-mail address removed)">
<input type="hidden" name="item_name" value="Pro Style ATF Ankle Brace with
Universal Fit">
<input type="hidden" name="item_number" value="212-E">
<input type="hidden" name="amount" value="20.95">
<input type="hidden" name="return"
value="http://www.skolsportsshop.com/success.htm">
<input type="hidden" name="cancel_return"
value="http://www.skolsportsshop.com/cancel.htm">
<input type="hidden" name="currency_code" value="USD">
<input TYPE="image" SRC="https://www.paypal.com/images/sc-but-03.gif"
NAME="submit0"alt="Make payments with PayPal - it's fast, free and secure!"
width="124" height="26">
<input type="hidden" name="add" value="1">
</form>

As you can see the two lines need to change depending on the radiobutton
action taken by the user the following two lines from:

<input type="hidden" name="item_number" value="212-E">
<input type="hidden" name="amount" value="20.95">

As you can see the two lines need to change depending on the radiobutton
action taken by the user the following two lines To:

<input type="hidden" name="item_number" value="212-D">
<input type="hidden" name="amount" value="225.00">

I figured this logic could be done by using a IF ELSE ENDIF around the four
lines of code and done in javascript by building a conditional exprersion for
the IF based on the action of the radiobutton my conditional expersion would
look something like this (amount[1].checked) or might be the following might
work also (amount[1].value = 20.95) the amount is the name properity of
both the radiobuttons because they are in the same group [1] is the first
item in the array and value or checked is the actual properity being tested
in the IF - what comes before the amount I am not shure of if anything but
remember the radiobutton sits in side a table and is in one of the cells of
the table.

THANKS
 
F

Frank H. Shaw

Ok I my form code which is not code but HTML markup within the form the input
type hidden two lines i am concerd about happen before the submit button code
The IF ELSE ENDIF logic is around thuose two lies and the two changed lines
which are in the code before the submit button in the code - the IF ELSE
ENDIF logic is inside javascript and is part of the javascript do I need to
have the javacode script happen with a onchange event refering to the
radiobuttons - How would I get the javascript to happen onchange event and
could someone give me a example of how it would look to do that type of
thing:

To make javascript "fire" due to an "event" contained within a form you need
to use an onchange or onselect event.
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr"
method="post">
<input type="hidden" name="item_number" value="212-E">
<input type="hidden" name="amount" value="20.95">
NAME="submit0"alt="Make payments with PayPal - it's fast, free and secure!"
width="124" height="26">


Steve Easton said:
Javascript only runs when the page is opened if you tell it to, using an onload statement in the
body tag or within the script tags in the page.

To make javascript "fire" due to an "event" contained within a form you need to use an onchange or
onselect event.


--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
........................with a computer

Frank H. Shaw said:
It has come to my understanding javascript runs when page is first opens this
would be a problem if I use javascript in what I am trying to do: I need to
understand how this can be stoped so javascript runs when the user selects
the submit button which happens afterr the user has selected a option in the
two radiobuttons that ask the user to choices pricing by each or pricing by
dozen. The logic which parses the action of the radiobutton is inside a form
that is contained in a table the form is used to send standard information to
paypal server but what changes is the item number and price which is barried
in some hidden input fields inside the form: I would be using some IF ELSE
ENDIF logic around the two lines of HTML that changed depending on wich
option the user selected in the radiobutton - since it has come to my
understanding that javascript runs when page opens javascript my not be the
answer and I might have to use PHP unstead But if PHP is the answer then I
need it to run when information is being sent to paypal so this means it has
to happen at the client side like HTML does. I have pasted at the bottom of
this message the form code which is used to send up to paypal:

I have created several threads around my problem and questions previous to
this posting you can get all the treads just look for my name Frank H. Shaw

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr"
method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="(e-mail address removed)">
<input type="hidden" name="item_name" value="Pro Style ATF Ankle Brace with
Universal Fit">
<input type="hidden" name="item_number" value="212-E">
<input type="hidden" name="amount" value="20.95">
<input type="hidden" name="return"
value="http://www.skolsportsshop.com/success.htm">
<input type="hidden" name="cancel_return"
value="http://www.skolsportsshop.com/cancel.htm">
<input type="hidden" name="currency_code" value="USD">
<input TYPE="image" SRC="https://www.paypal.com/images/sc-but-03.gif"
NAME="submit0"alt="Make payments with PayPal - it's fast, free and secure!"
width="124" height="26">
<input type="hidden" name="add" value="1">
</form>

As you can see the two lines need to change depending on the radiobutton
action taken by the user the following two lines from:

<input type="hidden" name="item_number" value="212-E">
<input type="hidden" name="amount" value="20.95">

As you can see the two lines need to change depending on the radiobutton
action taken by the user the following two lines To:

<input type="hidden" name="item_number" value="212-D">
<input type="hidden" name="amount" value="225.00">

I figured this logic could be done by using a IF ELSE ENDIF around the four
lines of code and done in javascript by building a conditional exprersion for
the IF based on the action of the radiobutton my conditional expersion would
look something like this (amount[1].checked) or might be the following might
work also (amount[1].value = 20.95) the amount is the name properity of
both the radiobuttons because they are in the same group [1] is the first
item in the array and value or checked is the actual properity being tested
in the IF - what comes before the amount I am not shure of if anything but
remember the radiobutton sits in side a table and is in one of the cells of
the table.

THANKS
 
J

Jens Peter Karlsen[FP-MVP]

See inline.
Ok I my form code which is not code but HTML markup within the form the input
type hidden two lines i am concerd about happen before the submit button code
The IF ELSE ENDIF logic is around thuose two lies and the two changed lines

There is no such thing as ENDIF in Javascript. Are you trying to mix
VBScript with Javascript?
which are in the code before the submit button in the code - the IF ELSE
ENDIF logic is inside javascript and is part of the javascript do I need to
have the javacode script happen with a onchange event refering to the
radiobuttons - How would I get the javascript to happen onchange event and
could someone give me a example of how it would look to do that type of
thing:

<input type="text" onchange: "some javascript">

Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.
 
F

Frank H. Shaw

So if there is no ENDIF in a IF statement what is used to set aside more then
one line of code and how do you know were the IF statement termnates or IF
ELSE termnates. THANKS
 
M

MD Websunlimited

In JavaScript

if (expression) {
statements if express is true
} else {
statements if express is false
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top