i have a form that will not accept a value

  • Thread starter java script help needed
  • Start date
J

java script help needed

i have a static box on my page and need it to have a toal in it, from their
order.

it keep having an error that the variable
document.tables.textboxtable
if null or not valid

i have used the form




var form = document.forms.FrontPage_Form1;

form.total.value = "£"+cent(ctotal)+"p";



and thought that i could also use


var total = document.tables.textboxtable;

table.textbox.value = "£"+cent(ctotal)+"p";


for tables is this right?




thanks
 
J

java script help needed

what is the correct way to add text to a text box,

the text that i will be having in this text box, is acually numbers from
another field within a form that is filled in by a visitor.

(what i am trying to do is: have a text box that has the total of an order
being placed, i have this total being added up and placed in a box near the
bottom of the page but would ideally want it to show in the top part of the
window while they shop and scroll down the page.)
 
J

Jens Peter Karlsen[FP-MVP]

No, you can't do it this way. A textbox is a form element so needs to be
in a form so you would address it in the same way as before. The form
may be in a table but that is not important here.

Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.

-----Original Message-----
From: java script help needed [mailto:thank you for your help]
Posted At: 27. juli 2004 23:15
Posted To: microsoft.public.frontpage.programming
Conversation: i have a form that will not accept a value
Subject: i have a form that will not accept a value


i have a static box on my page and need it to have a toal in it, from
their order.

it keep having an error that the variable document.tables.textboxtable
if null or not valid

i have used the form




var form = document.forms.FrontPage_Form1;

form.total.value = "£"+cent(ctotal)+"p";



and thought that i could also use


var total = document.tables.textboxtable;

table.textbox.value = "£"+cent(ctotal)+"p";


for tables is this right?




thanks
 
M

MD Websunlimited

Okay, what I think you wish to accomplish is to display the total at multiple locations on the web page. This also assumes that you
do not wish to communicate this total to a form processing routine but is strictly for display.

To accomplish you'll need a function that can insert or replace text on the page:

function displayValue(value,eleID) {
var element;
element = document.getElementById(eleID);
if (element.tagName == "DIV") {
element.innerText = value;
return true;
}

return false;
}
</script>

Next, you'll need an event to trigger a call to the function I've assumed a form field that loses focus.

<form ....>
<input type="textbox" onblur="displayValue(this.value,'total')" >
<input type="submit" value="Submit" >
</form>

Then you need a location to display the value, "eleID"

<div id="total"></div>


--
Mike -- FrontPage MVP '97-'02
http://www.websunlimited.com
FrontPage Add-ins Since '97 FP 2003 / 2002 / 2000 Compatible
 

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