Javascript what is need to do it in frontpage? and How do I determ

F

Frank H. Shaw

QUESTION 1 - I need to do it in javascript what is needed to do it in
javascript any tools or do I just write the script what do I have to do to
tell frontpage javascript is contained in the page:

QUESTION 2 - The exprison in the if statement below inside the javascript
the varable amount needs to refirer to the radiobutton which is HTML code
posted at the bottom of the page here:

<Script>

IF amount = 20.95

ENDIF

</script>


Below is my radiobutton HTML code which would come well before the
javascript code
above:

Was this post
 
F

Frank H. Shaw

I want to do something very simple just test the value in the radiobutton to
determine which radiobutton was seleceted inside a javascript in a simple if
else endif statement that is all I am trying to do:
 
M

MD Websunlimited

Okay, you have to iterate the radio button in the group, i.e, those with the same name.
// return the index of the radio that was selected
function indexRadio(theRadio) {
var i;
for (i = 0; i < theRadio.length ; i++) {
if (theRadio.checked) return i );
}
}

To call the function use an event handler, e.g. the clicking of the submit button

<input type="submit" onclick="alert('Radio index = ' + indexRadio(this.form.myRadio);); return true;" >

Note: The return true is required to allow the form submission. Also, if the form has a onsubmit event handler it will not be called
unless you do it explictly.


--
Mike -- FrontPage MVP '97-'02
http://www.websunlimited.com
Need to add Meta Tags to your web pages NOW with Google Bot controls.
http://www.websunlimited.com/order/Product/MTM2002/mtm2002_help_dir.htm
FrontPage Add-ins Since '97 2003 / 2002 / 2000 Compatible
 
F

Frank H. Shaw

Thank you very much now were do I put the IF ELSE ENDIF logic and would the
expersion logic be the place to call the event handler?

MD Websunlimited said:
Okay, you have to iterate the radio button in the group, i.e, those with the same name.
// return the index of the radio that was selected
function indexRadio(theRadio) {
var i;
for (i = 0; i < theRadio.length ; i++) {
if (theRadio.checked) return i );
}
}

To call the function use an event handler, e.g. the clicking of the submit button

<input type="submit" onclick="alert('Radio index = ' + indexRadio(this.form.myRadio);); return true;" >

Note: The return true is required to allow the form submission. Also, if the form has a onsubmit event handler it will not be called
unless you do it explictly.


--
Mike -- FrontPage MVP '97-'02
http://www.websunlimited.com
Need to add Meta Tags to your web pages NOW with Google Bot controls.
http://www.websunlimited.com/order/Product/MTM2002/mtm2002_help_dir.htm
FrontPage Add-ins Since '97 2003 / 2002 / 2000 Compatible


Frank H. Shaw said:
I want to do something very simple just test the value in the radiobutton to
determine which radiobutton was seleceted inside a javascript in a simple if
else endif statement that is all I am trying to do:
 
M

MD Websunlimited

Frank, the code provide determines which radio is selected. I would assume that you know what values are assigned to each radio
button so why would you need a logic statement?


Frank H. Shaw said:
Thank you very much now were do I put the IF ELSE ENDIF logic and would the
expersion logic be the place to call the event handler?

MD Websunlimited said:
Okay, you have to iterate the radio button in the group, i.e, those with the same name.
// return the index of the radio that was selected
function indexRadio(theRadio) {
var i;
for (i = 0; i < theRadio.length ; i++) {
if (theRadio.checked) return i );
}
}

To call the function use an event handler, e.g. the clicking of the submit button

<input type="submit" onclick="alert('Radio index = ' + indexRadio(this.form.myRadio);); return true;" >

Note: The return true is required to allow the form submission. Also, if the form has a onsubmit event handler it will not be
called
unless you do it explictly.


--
Mike -- FrontPage MVP '97-'02
http://www.websunlimited.com
Need to add Meta Tags to your web pages NOW with Google Bot controls.
http://www.websunlimited.com/order/Product/MTM2002/mtm2002_help_dir.htm
FrontPage Add-ins Since '97 2003 / 2002 / 2000 Compatible


Frank H. Shaw said:
I want to do something very simple just test the value in the radiobutton to
determine which radiobutton was seleceted inside a javascript in a simple if
else endif statement that is all I am trying to do:

:

Hi Frank,

FP does come with a Script Editor however unless you understand the language it will not be of much help.

http://office.microsoft.com/assista...in=EC010231151033&QueryID=nCS7pCbeL0&respos=1

I don't understand what you wish to do with the code that you've posted.


--
Mike -- FrontPage MVP '97-'02
J-Bots 2004 102 Components For FP
http://www.websunlimited.com
FrontPage Add-ins Since '97 FP 2003 / 2002 / 2000 Compatible

QUESTION 1 - I need to do it in javascript what is needed to do it in
javascript any tools or do I just write the script what do I have to do to
tell frontpage javascript is contained in the page:

QUESTION 2 - The exprison in the if statement below inside the javascript
the varable amount needs to refirer to the radiobutton which is HTML code
posted at the bottom of the page here:

<Script>

IF amount = 20.95

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

ELSE

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

ENDIF

</script>


Below is my radiobutton HTML code which would come well before the
javascript code
above:

<input TYPE="radio" CHECKED NAME="amount" VALUE="20.95"></span><span
style="font-size: 10.0pt; font-family: Trebuchet MS">By each</span></p>

<input TYPE="radio" NAME="amount" VALUE="225.00"></span><span
style="font-size: 10.0pt; font-family: Trebuchet MS">By Dozen</span></p>


THANKS



Was this post
 
R

Ronx

Did you look at my example at
www.rxs-enterprises.org/tests/pages/prices.htm ?
This has been revised since my previous post.
The example contains all the logic required.
--
Ron Symonds
Microsoft MVP (FrontPage)
Reply only to group - emails will be deleted unread.

Frank H. Shaw said:
Thank you very much now were do I put the IF ELSE ENDIF logic and
would the
expersion logic be the place to call the event handler?

MD Websunlimited said:
Okay, you have to iterate the radio button in the group, i.e, those
with the same name.
// return the index of the radio that was selected
function indexRadio(theRadio) {
var i;
for (i = 0; i < theRadio.length ; i++) {
if (theRadio.checked) return i );
}
}

To call the function use an event handler, e.g. the clicking of the
submit button

<input type="submit" onclick="alert('Radio index = ' +
indexRadio(this.form.myRadio);); return true;" >

Note: The return true is required to allow the form submission.
Also, if the form has a onsubmit event handler it will not be
called
unless you do it explictly.


--
Mike -- FrontPage MVP '97-'02
http://www.websunlimited.com
Need to add Meta Tags to your web pages NOW with Google Bot
controls.
http://www.websunlimited.com/order/Product/MTM2002/mtm2002_help_dir.htm
FrontPage Add-ins Since '97 2003 / 2002 / 2000 Compatible


Frank H. Shaw said:
I want to do something very simple just test the value in the
radiobutton to
determine which radiobutton was seleceted inside a javascript in
a simple if
else endif statement that is all I am trying to do:

:

Hi Frank,

FP does come with a Script Editor however unless you understand
the language it will not be of much help.

http://office.microsoft.com/assista...in=EC010231151033&QueryID=nCS7pCbeL0&respos=1

I don't understand what you wish to do with the code that you've
posted.


--
Mike -- FrontPage MVP '97-'02
J-Bots 2004 102 Components For FP
http://www.websunlimited.com
FrontPage Add-ins Since '97 FP 2003 / 2002 / 2000 Compatible

message
QUESTION 1 - I need to do it in javascript what is needed to
do it in
javascript any tools or do I just write the script what do I
have to do to
tell frontpage javascript is contained in the page:

QUESTION 2 - The exprison in the if statement below inside the
javascript
the varable amount needs to refirer to the radiobutton which
is HTML code
posted at the bottom of the page here:

<Script>

IF amount = 20.95

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

ELSE

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

ENDIF

</script>


Below is my radiobutton HTML code which would come well before
the
javascript code
above:

<input TYPE="radio" CHECKED NAME="amount"
VALUE="20.95"></span><span
style="font-size: 10.0pt; font-family: Trebuchet MS">By
each</span></p>

<input TYPE="radio" NAME="amount"
VALUE="225.00"></span><span
style="font-size: 10.0pt; font-family: Trebuchet MS">By
Dozen</span></p>


THANKS



Was this post
 
M

MD Websunlimited

Ronx,

Nice example but if that is what Frank is trying to accomplish then it makes no sense as it does not require a function call nor the
extra hidden field in the form.

1. The radio will send the code or amount, whichever you set the value to.
2. Use an onclick in the radio to set the item number or value to the hidden field, e.g. <input type="hidden" name="Item" > <input
type="radio" value="2.95" onclick="this.form.item.value='222-D'" >

When the form is submitted then the radio will have the price and the hidden field will have the item number (SKU)

--
Mike -- FrontPage MVP '97-'02
J-Bots 2004 102 Components For FP
http://www.websunlimited.com
FrontPage Add-ins Since '97 FP 2003 / 2002 / 2000 Compatible

Ronx said:
Did you look at my example at www.rxs-enterprises.org/tests/pages/prices.htm ?
This has been revised since my previous post.
The example contains all the logic required.
--
Ron Symonds
Microsoft MVP (FrontPage)
Reply only to group - emails will be deleted unread.

Frank H. Shaw said:
Thank you very much now were do I put the IF ELSE ENDIF logic and would the
expersion logic be the place to call the event handler?

MD Websunlimited said:
Okay, you have to iterate the radio button in the group, i.e, those with the same name.
// return the index of the radio that was selected
function indexRadio(theRadio) {
var i;
for (i = 0; i < theRadio.length ; i++) {
if (theRadio.checked) return i );
}
}

To call the function use an event handler, e.g. the clicking of the submit button

<input type="submit" onclick="alert('Radio index = ' + indexRadio(this.form.myRadio);); return true;" >

Note: The return true is required to allow the form submission. Also, if the form has a onsubmit event handler it will not be
called
unless you do it explictly.


--
Mike -- FrontPage MVP '97-'02
http://www.websunlimited.com
Need to add Meta Tags to your web pages NOW with Google Bot controls.
http://www.websunlimited.com/order/Product/MTM2002/mtm2002_help_dir.htm
FrontPage Add-ins Since '97 2003 / 2002 / 2000 Compatible


I want to do something very simple just test the value in the radiobutton to
determine which radiobutton was seleceted inside a javascript in a simple if
else endif statement that is all I am trying to do:

:

Hi Frank,

FP does come with a Script Editor however unless you understand the language it will not be of much help.

http://office.microsoft.com/assista...in=EC010231151033&QueryID=nCS7pCbeL0&respos=1

I don't understand what you wish to do with the code that you've posted.


--
Mike -- FrontPage MVP '97-'02
J-Bots 2004 102 Components For FP
http://www.websunlimited.com
FrontPage Add-ins Since '97 FP 2003 / 2002 / 2000 Compatible

QUESTION 1 - I need to do it in javascript what is needed to do it in
javascript any tools or do I just write the script what do I have to do to
tell frontpage javascript is contained in the page:

QUESTION 2 - The exprison in the if statement below inside the javascript
the varable amount needs to refirer to the radiobutton which is HTML code
posted at the bottom of the page here:

<Script>

IF amount = 20.95

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

ELSE

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

ENDIF

</script>


Below is my radiobutton HTML code which would come well before the
javascript code
above:

<input TYPE="radio" CHECKED NAME="amount" VALUE="20.95"></span><span
style="font-size: 10.0pt; font-family: Trebuchet MS">By each</span></p>

<input TYPE="radio" NAME="amount" VALUE="225.00"></span><span
style="font-size: 10.0pt; font-family: Trebuchet MS">By Dozen</span></p>


THANKS



Was this post

 

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