aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes How to access content of p tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to access content of p tag" Watch "How to access content of p tag" New topic
Author

How to access content of p tag

nirjari patel
Ranch Hand

Joined: Apr 23, 2009
Posts: 374
I am trying to access content of tag with id hours and mins. But it is not working. Please let me know, how to access content of p tag
I have tried following also, but I am not getting value from javascript.
I have tried following code, but gethrs() does not trigger with onload event. why

Thanks
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1478
    
    6

try this


Swastik
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Only input elements have values and .text does not exist.

Eric
nirjari patel
Ranch Hand

Joined: Apr 23, 2009
Posts: 374
When I am using this code, still its not working. WHen I add "document.getElementById("hours").innerHTML = dtObj.getHours();" , code stops working. If this line is not added in javascript, all alerts upto 4 are working. So there is something wrong with this code, which stops everything. What can be wrong with this ?


Whats the difference between two codes ? Bottom one is working, top one is not. I wouldlike to know the bug, this thing keeps happening.

Thanks
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18910
    
    8

Surely there must be something in the Javascript console if your Javascript code ends unexpectedly?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61661
    
  67

Not always. De-referencing an undefined values often results in a silent failure. It's sometimes infuriating.

So, what has been done to verify that the items that are being dereferenced are not undefined?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
nirjari patel
Ranch Hand

Joined: Apr 23, 2009
Posts: 374
I have re-written the code in a new file and its working.

Now this is my question. Where shall I start from for such a bug ? Now in this case, as you mentioned " what has been done to verify that the items that are being dereferenced are not undefined? " How can I verify this ?

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to access content of p tag