Subject:
|
Re: Transclusion via JavaScript (was: Re: Resolved: Yahoo is good for the 'net)
|
Newsgroups:
|
lugnet.publish
|
Date:
|
Sat, 23 Sep 2000 21:21:24 GMT
|
Viewed:
|
1179 times
|
| |
| |
"Todd Lehman" <lehman@javanet.com> wrote in message
news:G1Cpxr.Cqt@lugnet.com...
[snip]
> Interesting from an HTML/geek point of view! So, in the real shebang, they
> give something akin to
[script snipped]
> Anyway, that's an interesting underlying technique! HTML never natively had
> transclusion of content except for images, but this is a way to transclude
> arbitrary text content if you assume that the reader's browser can execute JS
> content.
>
> What does the SRC= attribute of the <SCRIPT> tag look like, for example? I'd
> like to see what they spit back for raw JS code. I bet it's just a bunch of
> documen.write() calls, but it might not hurt to check it for possible
nasties.
This is exactly what I do to generate my pages. My provider doesn't allow
server side scripting, so I used clientscript to generate the content that
is similar to all pages.
In my site the menu's on both sides in generated from script and all
pictures are done using script.
For example this page:
http://members.brabant.chello.nl/~f.buiting/lego/b.html
has a <script> tag at the top, the script basically uses document.writes()
that generates this: <table><tr><td>-left menu items-</td><td>. The <script>
tag on the bottom generates: </td><td>-menu right-</td></tr></table>.
The reason I use this technique is I write my HTML by hand so I want the
code to be tidy, the menu is a lot of code that reduces the readability of
the actual content's source AND if I want to change the menu, I only need to
change one file.
I also have functions to display items on my page that I want to have the
same layout over the whole site like the images. In the example above
(line162), I use a javascript function that generates a little piece of HTML
code with the parameters URL to picture, TargetUrl when clicked on and the
Comment text.
The major downside to this technique is that reader's browser has javascript
enabled... In non-JS browsers the body is still readable and formatted
correctly but the menus will not appear
--
Frank Buiting
Visit the LEGO Lexicon: http://members.chello.nl/~f.buiting/lego/
|
|
Message is in Reply To:
48 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|