I have a variable and i want to print its value as comment (not front end), so that the value can only be checked in view source. Its something like this: document.write("<!-- No of links Received = "+ google_ads.length+ "-->"); But in this case, when we do view source, we are able to simply see the same statement and not the actual value of google_ads.length. Could anyone please help?
Of course you are not going to see the stuff on the screen, that is the way that it works. It is not like a server side code with a Response.write, the server puts that in the page as it renders, client side code basically puts it into memory.
if you want to see the stuff on the screen you need type this into your address bar:
Joined: Oct 19, 2004
U r absolutely right in that but i dont want to print it on screen. Its for validation purposes that i have to log the length of the array as html comment. But in the above case when i do a view source, i see the same sattement whereas i want it to be like document.write("<!-- No of links Received = "+ 10 + "-->"); where 10 is the actual length of the array.
Joined: Nov 08, 2001
The view source is grabbing the document from cache not the source, there is no way for you to see the value that the page renders.