/    Sign up×
Community /Pin to ProfileBookmark

I support two small churches websites in N. Missouri. I am limited to 5mb of web space each. I would like to put a javascript scrolling navigation bar I use in one church site into a stylesheet and then load it into a div on each page. Then I would save a 130 – 150 lines of code on each page. Can such a thing be done? Also, at the other church, I would like to do the same with a simple table with navigation buttons and a large jpg image both made into a masthead for each page. Again I could save multiple copies of the same code. Any help greatfully appreciated, I’m rather a newby, but loving typing in changes, refreshing and see it appear like magic

Jim

to post a comment
CSS

4 Comments(s)

Copy linkTweet thisAlerts:
@ffurnaiAug 03.2005 — can't really do that with a stylesheet. But you could into some server side scripting (like PHP) and have your navbar load as an include.
Copy linkTweet thisAlerts:
@toicontienAug 03.2005 — You can place JavaScript in external files, just like CSS, but you can't mix the two. For instance, place all the JS functions your site uses in a file called function_lib.js. Place this file in your server space and then link to it properly using the following snippet in the <head> of your HTML document:
<i>
</i>&lt;script type="text/javascript" src="/url/to/function_lib.js"&gt;&lt;/script&gt;

If you really want to save on lines of code, consider converting the site from a table-based layout to CSS and <div>s. If you need help, just post here. Also, a visit to the CSS References thread at the top of this forum is a good idea too.

Generally, you can reduce HTML file sizes by 30 to 60 percent when going from tables to CSS and DIVs, since all the visual formatting information is placed in external CSS files (and downloaded once by the end-user).
Copy linkTweet thisAlerts:
@mikepurvisAug 03.2005 — You can place JavaScript in external files, just like CSS, but you can't mix the two.[/QUOTE]

It's funny that this should come up right now. I'm actually looking into developing a simple "client-side-includes" scheme that would be a single included js file, but able to unobtrusively pull in additional header/footer/sidebar content and inject it into the document post-load. Wouldn't be much use for us server-side guys, but it could be a lifesaver for some.

For the moment, you can just use an iFrame.
Copy linkTweet thisAlerts:
@toicontienAug 03.2005 — *groans* Avoid frames like the plague. Too many accessibility issues. If you're really worried about the 5MB limit, upload smaller images and fewer of them. That's where most of your site's data comes from.
×

Success!

Help @jma64658 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...