[Javascript] Print the contents of a variable into the source

Mike Dougherty mdougherty at pbp.com
Fri Aug 20 10:14:26 CDT 2004


I don't understand why you want a value in source but not displayed.

You say you have a table of metrics in SQL.  You want numbers from that table to appear in the 
source of an html page in the browser.  You don't want to (or can't) use a server-side script.

If you had a client-side javascript making a call to SQL and getting the value, it would still not 
be contained in the "source" you would see in the browser (by clicking "view page source")  I have 
a site that renders a menu in javascript - when you view source all you see where the menu is 
supposed to be is a javascript function call.  (even after the menu is rendered and on the screen)

What are you going to do with this information if you did manage to get it into the source?  I 
wonder if the ends can be achieved through different means...

On Fri, 20 Aug 2004 09:50:10 -0400
  Chris Nafziger <CNafziger at sauder.com> wrote:
>Right; that's not the problem... Getting the actual number (Value) to show
>up somewhere... ANHYWHERE in the source is the problem... Of course you are
>correct about the ASP; I could do it easily in ASP, but I cannot use it
>here.  I'm looking (probably in vain) for a pure JavaScript solution.  I'm
>thinking perhaps a couple native JS functions could get me to the point that
>a new variable KBPS789=789 if that's what kbps contains, but you still
>wouldn't actually see 789 in the source.  Anybody else have any ideas?
>
>-----Original Message-----
>From: Allard Schripsema [mailto:allard-schripsema at procergs.rs.gov.br] 
>Sent: Friday, August 20, 2004 8:30 AM
>To: [JavaScript List]
>Subject: RE: [Javascript] Print the contents of a variable into the source
>
>Hi Chris,
>I don´t get it.
>i guess if the variable is known, you can do a document.write,  innerText,
>objectx.value or something like that to show it.
>But that´s probably not the problem right?
>
>To make kbps appear in the source  you´d have to use a server side script ,
>and that means kbps is known at the server ( in asp and asp.Net:
><%response.write("<!--" & kbps & "-->")%> )
>
>If the kbps is determined using javascript, you cannot do what you want to
>do at the moment you want.
>you could consider reloading the same page sending your kbps in the
>querystring (or form, whatever) and getting it serverside and print it then.
>
>hope that helps,
>
>Allard Schripsema
>
>
>
>
>
>-----Original Message-----
>From: javascript-bounces at LaTech.edu
>[mailto:javascript-bounces at LaTech.edu]On Behalf Of Chris Nafziger
>Sent: Thursday, August 19, 2004 7:09 PM
>To: [JavaScript List]
>Subject: [Javascript] Print the contents of a variable into the source
>
>
>Really need some help on this one...  Seemed easy enough at first...
>
>nextpage='results.php?kbps=' + kbps;
>// what can I do here to print the contents of the nextpage variable
>somewhere in the source?
>document.location.href=nextpage;
>
>
><!--nextpage=results.php?kbps=1500-->
>Or
>//nextpage=results.php?kbps=1500
>
>...is what I need to see so it doesn't show up on the HTML page
>
>It's a long story involving SQL running a scheduled stored proc that
>executes pings, parses the results, summarizes the results, and sticks it in
>a database, along with this kbps value, retrieved from the source via a
>command line utility executed by the same stored procedure, so I end up with
>a table containing a constantly accumulating summary of speed, latency, and
>routing.
>
>I just need to get the contents of that variable into the source, so my
>parser can pick it up.
>
>Changing the other two lines of code, the other pages in the web, et cetera,
>is not an option.  Like I said... Long story.
>
>How do I print the contents of a variable into the source?
>
>
>
>
>
>-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>
>This e-mail and any files transmitted with it may contain privileged,
>confidential, or proprietary information which may be protected from
>disclosure under law, and is intended solely for the use of the individual,
>group, or entity to whom this e-mail is addressed.  If you are not one of
>the named recipients, please notify the sender by e-mail and delete this
>message immediately from your computer.  Any other use, retention,
>dissemination, forwarding, printing, or copying of this e-mail is strictly
>prohibited.  Thank you for your assistance.
>
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript
>
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript




More information about the Javascript mailing list