Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #29044
| Path | csiph.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!1.eu.feeder.erje.net!news.albasani.net!.POSTED!super70s |
|---|---|
| From | super70s <super70s@super70s.invalid> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: "weekly" javascript? |
| Date | Sun, 27 Dec 2015 12:03:13 -0600 |
| Organization | albasani.net |
| Lines | 53 |
| Message-ID | <super70s-2E4557.12031327122015@reader.albasani.net> (permalink) |
| References | <super70s-3DE5C2.10244827122015@reader.albasani.net> <XmlHttpRequest-JSON-DHTML-20151227174128@ram.dialup.fu-berlin.de> |
| X-Trace | news.albasani.net QgQ7Q8s125UmP9qdea3FOtt+s9iztnoWZQXxFX22+YlKak8D/ijO+svjbXpiFGTUwYiO2JqDFuw7kjFzEgiiBBe9bpmsjI9eqP9hotLyvkTKkK+PfNea3E4YE1TJ8SRs |
| NNTP-Posting-Date | Sun, 27 Dec 2015 18:03:18 +0000 (UTC) |
| Injection-Info | news.albasani.net; logging-data="pqwb3SjD7XLVsC0YPc7UR5uGnG1tdBmRgrnx7kJDmXVHjRL3/tnDTLG98FAE2twQrnK19icuwEfghzi/KFbeUCv+X4vwGqROlFABSR/WASfGIrsUf4QEKwjYUR7kk2ek"; mail-complaints-to="abuse@albasani.net" |
| User-Agent | MT-NewsWatcher/3.5.2 (PPC Mac OS X) |
| X-No-Archive | yes |
| Cancel-Lock | sha1:/YEUu+NPMPSTs2skYeF9zu8X6is= |
| Xref | csiph.com comp.lang.javascript:29044 |
Show key headers only | View raw
In article
<XmlHttpRequest-JSON-DHTML-20151227174128@ram.dialup.fu-berlin.de>,
ram@zedat.fu-berlin.de (Stefan Ram) wrote:
> super70s <super70s@super70s.invalid> writes:
> >I was just wondering if there's a good JS I could use for this, say put
> >all 52 weekly items in a separate file and then have the appropriate
> >item come up according to what week it is?
> >I just don't know if this could work with the HTML markup that's
> >required for the above, when I tried to insert HTML (say, bold text) for
> >the birthday one, it wouldn't work at all.
>
> The following example shows how to insert a strong element
> read from a file »example«.
>
> <!DOCTYPE HTML><html><head><meta charset="UTF-8">
> <title>Main</title>
> </head><body>
> <p id="id201512271754350100"></p>
> <pre><code>
> <script type="application/javascript;version=1.8">
> ( { "main": function()
> { "use strict";
> let mainThis = this;
> var xmlhttp = new XMLHttpRequest();
> xmlhttp.onreadystatechange = function()
> { if( xmlhttp.readyState == 4 && xmlhttp.status == 200 )
> { console.log( this.insert );
> mainThis.insert( JSON.parse( xmlhttp.responseText )); }};
> xmlhttp.open
> ( "GET", "http://userpage.fu-berlin.de/~ram/pub/JSON/example",
> true );
> xmlhttp.send(); },
> "insert" : function( object )
> { "use strict";
> let e = document.createElement( 'strong' );
> let t = document.createTextNode( object[ 0 ] );
> e.appendChild( t );
> document.getElementById( 'id201512271754350100' ).
> appendChild( e ); }}.main() );
> </script></code></pre></body></html>
OK, but how do I indicate the appropriate element to come up according
to the week of year?
I think it would be way too complicated to pull off the more I think
about it, in some years it would be "week ending Jan. 1, Jan. 8, Jan.
15...," then in another one it would be something like "week ending Jan.
3, Jan. 11, Jan. 17...."
For each of the 5 groups (1970/75, 1971/76, 1972/1977, 1973/1978 and
1974/1979), I would need to indicate a firm date (plus 7 days since it's
"week ending...") to pull up the appropriate element, I guess.
Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread
Re: "weekly" javascript? super70s <super70s@super70s.invalid> - 2015-12-27 12:03 -0600
Re: "weekly" javascript? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-28 12:26 +0100
Re: "weekly" javascript? RobG <rgqld@iinet.net.au> - 2016-02-06 17:06 +1000
Re: "weekly" javascript? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-02-06 10:59 +0100
csiph-web