views:

43

answers:

2

Is there anyway of defining a pageID sort of thing to an html page, for using in javascript code...

+1  A: 

An identifier for the whole page? Why not use the URL?

Damo
sorry, didn't get it...
Rahul Utb
A: 

Specify an id on the body?

<body id='some_unique_id_for_page'>

Jamie Wong
ok fine, thanks. Now to take use of this id can we anyhow fetch through javascript whats the id of this tag ?
Rahul Utb
Yes, easily. In jQuery, it would simple be `$('body').attr('id')`. In native javascript, it would be something like: `document.getElementsByTagName('body')[0].id`.
Jamie Wong
thanks Mr. Wong
Rahul Utb