I've inherited a project that has quite a few Table rows - inside each cell,
within the row are a couple of textboxes ("in" and "out"), along with a
"total" label.
Also - this is all within a Content Page/Master Page scenario - I've got the
function inside the Content page, along with the all the items herein
On each row, each of the in and out and total controls have a number
associated with them, like:
In1, Out1, total1
In2,Out2, total2, etc
For each Out textbox, I'm adding the onblur attribute to run this function
I'm trying to create ONE javascript function to add the in and out
textboxes, based the number of the row, which will add the two textbox
values, and put it in the label for that row, but I keep getting errors and
I'm not sure what to do....
I've got a function started but it keeps getting errors, and I'll admit I'm
not a pro with JS. Here's what I've got so far:
function getmiles(num) {
start=document.getElementById("In" + num).getAtribute("value"); // < -
can't find
end=document.getElementById("Out" + num).getAtribute("value");
document.getElementById("Total" + num).getAtribute("value")=start-end;
}
'num' is getting populated, for sure. The main error is
'document.getElementById("..") is null or not an object, plus a couple of
"object expected" errors....
it happens any time I use the structure above (document.getElementById("In"
+ num).getAtribute("value"))
can someone help me here? 1 8539
Controls in content pages have combined id. You can see them if you view the
html source of the page when it is displayed in your browser.
This javascript function can assist you in finding controls by the tag name
and partial control id:
function findControl(tagName, controlId)
{
var aControls = document.getElementsByTagName(tagName);
if (aControls==null)
return null;
for (var i=0; i< aControls.length; i++)
{
var j = aControls[i].id.lastIndexOf(controlId);
if ((j -1) && (j == (aControls[i].id.length - controlId.length)))
return aControls[i];
}
return null;
}
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET] http://msmvps.com/blogs/egoldin http://usableasp.net
"Elmo Watson" <ew@yahoo.nospam.comwrote in message
news:Or**************@TK2MSFTNGP06.phx.gbl...
I've inherited a project that has quite a few Table rows - inside each
cell, within the row are a couple of textboxes ("in" and "out"), along
with a "total" label.
Also - this is all within a Content Page/Master Page scenario - I've got
the function inside the Content page, along with the all the items herein
On each row, each of the in and out and total controls have a number
associated with them, like:
In1, Out1, total1
In2,Out2, total2, etc
For each Out textbox, I'm adding the onblur attribute to run this function
I'm trying to create ONE javascript function to add the in and out
textboxes, based the number of the row, which will add the two textbox
values, and put it in the label for that row, but I keep getting errors
and I'm not sure what to do....
I've got a function started but it keeps getting errors, and I'll admit
I'm not a pro with JS. Here's what I've got so far:
function getmiles(num) {
start=document.getElementById("In" + num).getAtribute("value"); // < -
can't find
end=document.getElementById("Out" + num).getAtribute("value");
document.getElementById("Total" + num).getAtribute("value")=start-end;
}
'num' is getting populated, for sure. The main error is
'document.getElementById("..") is null or not an object, plus a couple of
"object expected" errors....
it happens any time I use the structure above
(document.getElementById("In" + num).getAtribute("value"))
can someone help me here?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: phil1bruening |
last post by:
Hi,
How can I change webcontrols from a contentpage in the masterpage?
|
by: Leffe Andersson |
last post by:
Hi folks!
I have a MasterPage with some public methods, and I would like to call them
from a (app_code) class. Is it possible to set a directive or an assembly
reference to a MasterPage from a...
|
by: User |
last post by:
OK, I asked in a reply, but I've wasted far too long so I'm going to put
a new post out there in hopes that it will be more visible.
I have a MasterPage. I want to call a method declared in that...
|
by: jeffmagill |
last post by:
Is it possible? I haven't been able to find any information about this.
Not on the web, not in books.
Is it possible to call a function or subroutine which is defined in a
MasterPage from it's...
|
by: musosdev |
last post by:
Hi guys
I'm using a MasterPage for my website rebuild (vs2005, .net2, c#).
I want to be able to control the Title element, both on the MasterPage and
the Content pages. For example, on each...
|
by: Bon |
last post by:
Dear all
I create a master page with image buttons on the left-hand side for
navigation. When a user clicks the student button, the content (i.e.
ContentPlaceholder) in masterpage will be...
|
by: =?Utf-8?B?Sm9obg==?= |
last post by:
I have a dropdownlist in masterpage and a big table in contentpage. When ddl
selection changes, I want to move a specific row of the table to the top of
the contentpage. Can I do something like <a...
|
by: =?Utf-8?B?SmFwZQ==?= |
last post by:
Can I refer to the controls on default.aspx from the masterpage?
I have a form on the masterpage which sends information that is in a
gridview in the default.aspx page.
|
by: Sully |
last post by:
I know this is a basic question, but I cannot find the answer.
I have a 3 LinkButtons on the masterpage that set a session variable,
this session variable does not get relayed to the content page...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |