Failing to retrieve data from HTMLIn my HTML page that calls Ajax I have a field defined as:-<td width=195 style="position:absolute; visibility: hidden;" id="CNumber" name="CNumber"></td>and in Ajax I

In my HTML page that calls Ajax I have a field defined as:-
<td width=195 style="position:absolute; visibility: hidden;" id="CNumber" name="CNumber"></td>
and in Ajax I attempt to retrieve its contents by :-
        var KaartNommer      = document.getElementById("CNumber").innerHTML;
and I have also tried:-
        var KaartNommer      = document.getElementById("CNumber").value;
both fail and doing an alert() I get told that it is undefined.

Please tell me how I got this wrong as other field values on the same webpage defined & retrieved in the same manner work fine.


Regards,
Alf Stockton.
0
straygrey
9/5/2007 12:03:11 PM
asp.net.ajax-ui 9760 articles. 0 followers. Follow

5 Replies
1607 Views

Similar Articles

[PageSpeed] 32
Get it on Google Play
Get it on Apple App Store

Are you sure the td with Cnumber ID is the only instance, any chance that the td is repeated?


Long Live .NET
Kazi Manzur Rashid (Amit)
_________________________
Web: http //dotnetshoutout.com
Blog: http://weblogs.asp.net/rashid
Twitter: http://twitter.com/manzurrashid
0
KaziManzurRashid
9/5/2007 7:55:15 PM

Does not look likely as the surrounding and offending code looks like:-

 <tr>
<td width=195 style="position:absolute; visibility: hidden;" id="NumberOfCard" name="NumberOfCard"></td>
<td width=195 style="position:absolute; visibility: hidden;" id="SlotsIssued"></td>
<td width=195 style="position:absolute; visibility: hidden;" id="TablesIssued"></td>

 

Note that I have changed the name from CNumber to NumberOfCard, just in case that was the problem. 


Regards,
Alf Stockton.
0
straygrey
9/6/2007 4:54:53 AM

Hi,

It sound wacky, document.getElementById("CNumber").innerHTML should work!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Untitled Page</title>

    <script language="javascript" type="text/javascript">
// <!CDATA[

function Button1_onclick() {
var KaartNommer      = document.getElementById("NumberOfCard").innerHTML;
alert(KaartNommer);
}

// ]]>
    </script>

</head>
<body>
    <table>
        <tr>
            <td width="195" style="position: absolute; visibility: hidden;" id="NumberOfCard"
                name="NumberOfCard">
                alert string
            </td>
            <td width="195" style="position: absolute; visibility: hidden;" id="SlotsIssued">
            </td>
            <td width="195" style="position: absolute; visibility: hidden;" id="TablesIssued">
            </td>
        </tr>
    </table>
    <input id="Button1" type="button" value="button" onclick="return Button1_onclick()" />
</body>
</html>

If the above code work,your code should work too,please check out if it works on your machine.

If it works on your machine,it must be some mistakes in your code,you can post your code to us.

Best Regards


Sincerely,
Jin-Yu Yin
Microsoft Online Community Support
0
Jin
9/7/2007 9:22:36 AM

Hi,

It sound wacky, document.getElementById("CNumber").innerHTML should work!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Untitled Page</title>

    <script language="javascript" type="text/javascript">
// <!CDATA[

function Button1_onclick() {
var KaartNommer      = document.getElementById("NumberOfCard").innerHTML;
alert(KaartNommer);
}

// ]]>
    </script>

</head>
<body>
    <table>
        <tr>
            <td width="195" style="position: absolute; visibility: hidden;" id="NumberOfCard"
                name="NumberOfCard">
                alert string
            </td>
            <td width="195" style="position: absolute; visibility: hidden;" id="SlotsIssued">
            </td>
            <td width="195" style="position: absolute; visibility: hidden;" id="TablesIssued">
            </td>
        </tr>
    </table>
    <input id="Button1" type="button" value="button" onclick="return Button1_onclick()" />
</body>
</html>

If the above code work,your code should work too,please check out if it works on your machine.

If it works on your machine,it must be some mistakes in your code,you can post your code to us.

Best Regards


Sincerely,
Jin-Yu Yin
Microsoft Online Community Support
0
Jin
9/7/2007 9:23:06 AM

Due to pressure of deadlines I have stopped with the Ajax/Javascript & have used php session variables which work fine and have resolved the problem.

Thanks for trying to help. 


Regards,
Alf Stockton.
0
straygrey
9/7/2007 11:12:05 AM
Reply:

Similar Artilces:

what's the different from "<page src="">" and "<page codeBehind="">"
what's the different from "<page src="">" and "<page codeBehind="">" Thank YOU how to make session' life longer? Thank You This very question was asked only 5 days ago. Searching the forums would have yielded the answer you require. However, see this thread. Steven BeyRecursion: see Recursion You can set a new value for the Session Timeout in your web.config file. Or, you can do it in a page through this property: Session.Timeout Note that if you choose the second method, the timeout will only be modified on this page,...

What is this for? "<label style=""display:none;"" for=""" & cboFieldType.ClientID.ToString & """>Type</label>"
I'm digging through the code of DNN and I found many ocurrences of this type of code: lblFieldType.Text = "<label style=""display:none;"" for=""" & cboFieldType.ClientID.ToString & """>Type</label>" What is that code for? The label is never displayed and I could not figure out what DDN uses it for. thank you This is for ADA compliance. The guidelines require that form elements have an associated label. This helps the text readers out with identifying the different parts of the form. BruceDynamic...

<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTg3MjQ" />
 Hi I am developig a website and when I try to see the page source in the explorer I have houndreds of lines about this:<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" /><input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" /><input type="hidden" name="__VIEWSTATEFIELDCOUNT" id="__VIEWSTATEFIELDCOUNT" value="697" /><input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value=...

Regular Expression to remove "/", "\", "<", ">" and "="
Can anyone please show me the regular expression to reject a string ("<blue", "right>" etc.) which has the following expression in it: "/", "\", "<", ">" and "="  hi, It may Help u.. it is in Class file u may use this expressin in validation controls also. Regex objReg = new Regex(@"^[^,.?/\~|`;:'<>]*$", RegexOptions.Singleline); Regex objReg = new Regex(@"^[^,][^.][^?][^/][^\][^~|][^`][^;][^:][^'][[^<][^>]$", RegexOptions.IgnoreCase);Thanks &...

"<->" as "->" with automatic "is rw"
I like that arguments will be readonly by default. But when I look at my current code, I see that I would be typing " is rw" quite a lot, which in my opinion is too long for a thing that occurs very often. Every such situation in my code is a foreach loop. A thing that in Perl 6 will mostly be used with the pointy sub declaration syntax. If I'm not mistaken, <-> is still available. It communicates "bidirectional" and that is more or less the same as read/write access. I'm proposing for zip(@foos, @bars, @xyzzies) <-> $foo, $bar, $xyzz...

How can I access < input type="hidden" name="objHidden" id="objHidden" > from a .net server side function
Topic says it all..please help!! Right Click the control in the design view and select run as server control. ...

Issue while assigning tr.innerHTML = "<td>a</td><td>b</td>";
tr = document.createElement('tr'); tr.innerHTML = "<td>a</td><td>b</td>"; print(tr.innerHTML); result:- "ab" expected:- "<td>a</td><td>b</td>" https://bugzilla.mozilla.org/show_bug.cgi?id=467872 ...

superreview requested: [Bug 427928] "ASSERTION: Non-border-colors case with borderColorStyleCount < 1 or > 3" and "ASSERTION: Unhandled border style" with <table style="outline: auto; "></table> : [At
Mats Palmgren <mats.palmgren@bredband.net> has asked David Baron [:dbaron] <dbaron@mozilla.com> for superreview: Bug 427928: "ASSERTION: Non-border-colors case with borderColorStyleCount < 1 or > 3" and "ASSERTION: Unhandled border style" with <table style="outline: auto;"></table> https://bugzilla.mozilla.org/show_bug.cgi?id=427928 Attachment 314802: Patch rev. 1 https://bugzilla.mozilla.org/attachment.cgi?id=314802&action=edit ------- Additional Comments from Mats Palmgren <mats.palmgren@bredband.net> Not sure...

superreview denied: [Bug 427928] "ASSERTION: Non-border-colors case with borderColorStyleCount < 1 or > 3" and "ASSERTION: Unhandled border style" with <table style="outline: auto; "></table> : [Attac
David Baron [:dbaron] <dbaron@mozilla.com> has denied Mats Palmgren <mats.palmgren@bredband.net>'s request for superreview: Bug 427928: "ASSERTION: Non-border-colors case with borderColorStyleCount < 1 or > 3" and "ASSERTION: Unhandled border style" with <table style="outline: auto;"></table> https://bugzilla.mozilla.org/show_bug.cgi?id=427928 Attachment 314802: Patch rev. 1 https://bugzilla.mozilla.org/attachment.cgi?id=314802&action=edit ...

"<table></table>" and "<frameset><frame></frame></frameset>" in perl/tk
Dear my friends... Anybody would be so kind telling me what is similar in perl/tk to arrange the location of a form written in perl/tk? I want a nice look for my perl/tk application. Somewhat like this below: 1. Name : <place to type-in> 2. Address : <place to type-in> 3. Telephone : <place to type-in> I have made the main menu of my application with "Menubutton". And I want if the user click on the menu that what the user see is only the aimed application displayed on the determined area (under the main menu) but the menu has no change in po...

Why is "<MyControl ... />" different to "<MyControl ...> </MyControl>"
Hi I have made a CompositeControl and had it working fine. The sequence of events was: Page -> Page_Load(), MyControl -> CreateChildControls(). This was fine because I had to set a certain property in my control during page load before CreateChildControls was called. Anyway.... suddenly it all stopped working and it turned out that the sequence of events changed to MyControl -> CreateChildControls(), Page -> Page_Load(). This caused it to blow up because the property was not set. After a few hours of pulling my hair out and undoing all the recent changes I had made it turns out...

how do i do &lt;a href="#name"&gt; &lt;a name="name"&gt; on immagebutton
if the page is too long, when the page is posted back, i want it to move to original location where the user click it. can i do it with imagebutton without using Response.Redirect ?...

Query performance of "=" vs "<" and ">"
Suppose you have a large table (>5 million records) containing 15 columns including a numerical string column called ACTIVITY_DATE which is indexed (nonunique, nonclustered) and a numerical string column called TIMESTAMP which is indexed (nonunique,nonclustered). ACTIVITY_DATE contains a date string ('20081211'); TIMESTAMP also appends a time ('20081211 19:18:03.34923'). Suppose you want to return all events that took place on December 11th and suppose you had to choose between the following queries: - select col1,col2,col3 from TABLE where ACTIVITY_DATE='2...

Query performance of "=" vs "<" and ">"
[This is a repost from ase.general] Suppose you have a large table (>5 million records) containing 15 columns including a numerical string column called ACTIVITY_DATE which is indexed (nonunique, nonclustered) and a numerical string column called TIMESTAMP which is indexed (nonunique,nonclustered). ACTIVITY_DATE contains a date string ('20081211'); TIMESTAMP also appends a time ('20081211 19:18:03.34923'). Suppose you want to return all events that took place on December 11th and suppose you had to choose between the following queries: - select col1,col2,col...

Web resources about - Failing to retrieve data from HTMLIn my HTML page that calls Ajax I have a field defined as:-<td width=195 style="position:absolute; visibility: hidden;" id="CNumber" name="CNumber"></td>and in Ajax I - asp.net.ajax-ui

Resources last updated: 1/3/2016 5:43:10 AM