Convert javascript print-tag to html

T

Timmermans

Hi,

In an attempt to get rid of all javascript on my page, I was looking for the
html/css/whatever equivalent of the following javascript tag;

<a href="javascript:window.print();">

I'm using css media="print", so all I need is the trigger to start printing.

I can't find one on the net, anyone here who knows more?

Thanks

Kind Regards,
Steven
 
J

Jonathan N. Little

Timmermans said:
Hi,

In an attempt to get rid of all javascript on my page, I was looking for the
html/css/whatever equivalent of the following javascript tag;

<a href="javascript:window.print();">

There isn't one, it call the "print" button on the browser.
I'm using css media="print", so all I need is the trigger to start printing.

That just defines that styling to be used when printing. CSS cannot
trigger anything, except the pseudo "triggers" dynamic pseudo-classes:
:hover, :active, and :focus
 
S

Sherm Pendley

Timmermans said:
In an attempt to get rid of all javascript on my page, I was looking for the
html/css/whatever equivalent of the following javascript tag;

<a href="javascript:window.print();">

I'm using css media="print", so all I need is the trigger to start printing.

Why do you think you need that? Do you seriously believe the user is too
stupid to use the same "File/Print" menu item that works the same way on
every web page he or she visits?

Do you think the user is patient enough to try to figure out what icon you
use and where you've placed your on-page print link, when the standard menu
item is the same place it's always been, and works just as well as it always
has?

sherm--
 
T

Timmermans

Sherm Pendley said:
Why do you think you need that? Do you seriously believe the user is too
stupid to use the same "File/Print" menu item that works the same way on
every web page he or she visits?

No. But I myself for example, I use full screen and have dissabled many of
the buttons including print. ctrl+p is the way I call it myself, but not
everyone knows their keyboard shortcuts either. I consider it a sort of
added value, no matter how little.
Do you think the user is patient enough to try to figure out what icon you
use and where you've placed your on-page print link, when the standard
menu
item is the same place it's always been, and works just as well as it
always
has?

Yes.

Because my page is to wide to be printed on a standard A4, hence the CSS
tweak, resizing is not an option! 700 pages and the print icon is very
visible and always on the exact same spot. Who are you to judge it's
excessive and that it can't be used alongside the standard menu button? A
minimalistic approach is not what I'm looking for.

btw, your 'select a style' feature on camelbones doesn't work
crossbrowser... now that's something the users don't need!

All a matter of what you want and how you want it.

Regards,
Steven
 
T

Timmermans

Jonathan N. Little said:
There isn't one, it call the "print" button on the browser.


That just defines that styling to be used when printing. CSS cannot
trigger anything, except the pseudo "triggers" dynamic pseudo-classes:
:hover, :active, and :focus

Jonathan,

Rather dissapointed to learn there is no alternative for something so
common.

I guess I can't win them all ;-)

Thanks.

Regards,
Steven
 
S

Sherm Pendley

Timmermans said:
btw, your 'select a style' feature on camelbones doesn't work
crossbrowser... now that's something the users don't need!

On the contrary - the most common browser used by my visitors (Safari)
does not provide a built-in means to select among alternative stylesheets.
Unlike your misguided attempt to duplicate the wheel, the in-page select
box provides an option that the browser itself does not.

And I don't care about IE/Windows compatibility, because it's a site of
interest only to Mac users anyway.

Since you've descended to to ad hominem attacks - illogical and incorrect
ones at that - instead of rational debate, I will discuss this no further
with you.

sherm--
 
M

Michael Fesser

..oO(Sherm Pendley)
And I don't care about IE/Windows compatibility, because it's a site of
interest only to Mac users anyway.

Since you've descended to to ad hominem attacks - illogical and incorrect
ones at that - instead of rational debate, I will discuss this no further
with you.

And Mac users will never be in a situation where they might have to use
a Windows browser? Is _that_ logical and rational?

Just curious.

Micha
 
T

Timmermans

Sherm Pendley said:
On the contrary - the most common browser used by my visitors (Safari)
does not provide a built-in means to select among alternative stylesheets.
Unlike your misguided attempt to duplicate the wheel, the in-page select
box provides an option that the browser itself does not.

And I don't care about IE/Windows compatibility, because it's a site of
interest only to Mac users anyway.

Since you've descended to to ad hominem attacks - illogical and incorrect
ones at that - instead of rational debate, I will discuss this no further
with you.

sherm--

Sherm, not all users are mac users! I've visited your site out of
curiousity, and pointed out the obvious. It was not meant as an attack just
as your comments were not meant te give me an answer to my problem.

"Unlike your misguided attempt to duplicate the wheel, the in-page select
box provides an option that the browser itself does not." ...nyeah, if only
it would work for what is still the most comon browser, lol. As for
reinventing the wheel, I'm not trying to... ...I could actually ask the
same, why is it that you provide several links up to three times if the user
could find it on one only?

Nevermind how you dress up a site, or which gimmicks you have, above all it
should remain functional and accessible and not just for your target
audience. When designing a site, eben if it would validate html4 strickt,
try to include crossbrowsercompatibility (IE, FF, ...whatever) and
accessability rules so everyone can enjoy the site. If as a designer (?)
you push aside these basics, you are in no possition to judge nor set the
limits on other peoples work or requests. Unless ofcourse they are Mac users
who don't give diddly about the rest of the world. ;-)

Kind Regards,
Steven
 
J

Jonathan N. Little

Cheap shot, when he say doesn't work says don't work he means "in IE".
BTW Sherm it would be easy to fix for IE. All you have to do is set and
use the OPTION's value and not selectedIndex:

<select onclick=
"changeStyle(this.value); rememberStyle('CamelBonesStyle',120);
this.value = 0;">
<option value="">
--- Select a style ---
</option>

<option value="0">
Plain (no style)
</option>

<option value="1">
Aqua
</option>

<option value="2">
Aqua - No Tree
</option>

<option value="3">
Black
</option>
On the contrary - the most common browser used by my visitors (Safari)
does not provide a built-in means to select among alternative stylesheets.
Unlike your misguided attempt to duplicate the wheel, the in-page select
box provides an option that the browser itself does not.

True. The print button be a "feature" of the browser for a long time ;-)
 
S

Sherm Pendley

Jonathan N. Little said:
Cheap shot, when he say doesn't work says don't work he means "in
IE". BTW Sherm it would be easy to fix for IE.

Probably, but CamelBones itself is a Mac developer's toolkit that doesn't
run on Windows, and probably never will. It's a rare site for which IE/Win
is the tiny minority (< 5%), and I intend to enjoy my freedom while I have
the chance. :)

sherm--
 
S

Sherm Pendley

Timmermans said:
Sherm, not all users are mac users!

All my users are. CamelBones is a toolkit for Mac developers. It doesn't
run on Windows, and probably never will.
"Unlike your misguided attempt to duplicate the wheel, the in-page select
box provides an option that the browser itself does not." ...nyeah, if only
it would work for what is still the most comon browser, lol.

The most common browser on that site is Safari, with 45%. Not only does the
in-page select box work on Safari, it provides the *only* means for Safari
users to select among alternative stylesheets. You're comparing apples and
oranges.

Show me a browser that doesn't have its own standardized built-in "print"
command, and then your comparison will make sense.

sherm--
 
J

Jonathan N. Little

Sherm said:
Probably, but CamelBones itself is a Mac developer's toolkit that doesn't
run on Windows, and probably never will. It's a rare site for which IE/Win
is the tiny minority (< 5%), and I intend to enjoy my freedom while I have
the chance. :)

I may be developing for Mac but at the moment using a Windows computer.
Anyway the fix is simple.
 
T

Timmermans

Sherm Pendley said:
All my users are. CamelBones is a toolkit for Mac developers. It doesn't
run on Windows, and probably never will.


The most common browser on that site is Safari, with 45%. Not only does
the
in-page select box work on Safari, it provides the *only* means for Safari
users to select among alternative stylesheets. You're comparing apples and
oranges.

Show me a browser that doesn't have its own standardized built-in "print"
command, and then your comparison will make sense.

Well yeah if you want to talk about built in features you can stretch that
as far as you want... why put in a 'Home' link 3 times if people can use
their browsers history to get back to that page? If I wanted a basic site
with no features at all, I would have uploaded the entire thing in .txt
format... and even then they would be more compatible then yours.

Compare apple and oranges if you will, my print button, though perhaps
excisive, works for everyone, your Mac only stylesheets don't. I'm not
doing anything wrong by putting in a print button, so what's your beef
anyway?

Kind Regards,
Steven
 
T

Timmermans

Sherm Pendley said:
Probably, but CamelBones itself is a Mac developer's toolkit that doesn't
run on Windows, and probably never will. It's a rare site for which IE/Win
is the tiny minority (< 5%), and I intend to enjoy my freedom while I have
the chance. :)

sherm--

Enjoy your freedom? Good joke man... !!! :)
How about the freedom of your users, them non Mac users, how many visitors
do they represent? If everyone starts designing like that, you actually
create some sort of ghetto for Mac users, IE users passing by seeing no more
then a middle finger in the name of that freedom. I would expect better for
someone who presents himself as a pro.

Sherm, you say you only have 5% of IE/Win users, a self-limited amount, how
many visitors you might have if your site would be available to everyone?

The whole idea to build a website is to attrackt visitors and inform people,
it is why you're posting your links in your sig, no? So I, a non Mac user,
visit your site and turns out you've build a site site for Mac users only.
If you can't be bothered with non Mac users why not inform them in your sig
that your sites are for Mac users only and that others don't have to bother
to visit because they only get half the works? Why not just post your sig
in stricktly Mac communities? How much of you freedom would that take?

Kind Regards,
Steven
 
J

Jonathan N. Little

Timmermans said:
Well yeah if you want to talk about built in features you can stretch that
as far as you want... why put in a 'Home' link 3 times if people can use
their browsers history to get back to that page?

And if you entered your site not form the home page, but directly for
bookmark or external link form another site? Bad argument!
If I wanted a basic site
with no features at all, I would have uploaded the entire thing in .txt
format... and even then they would be more compatible then yours.

Now you are being silly...
Compare apple and oranges if you will, my print button, though perhaps
excisive, works for everyone, your Mac only stylesheets don't. I'm not
doing anything wrong by putting in a print button, so what's your beef
anyway?
They are not Mac only, just not IE friendly, although Sherm could easily
correct this as I have posted...

Back to the point in hand, there is no HTML | CSS print solution for you
only JavaScript and it is very unnecessary since the browser has a Print
button and now most have Print Preview as well.
 
T

Timmermans

Jonathan N. Little said:
And if you entered your site not form the home page, but directly for
bookmark or external link form another site? Bad argument!

A homepage link on the homepage, makes sense? Just as much as using frames.
Now you are being silly...

Yeah, then again, this whole thread is... I really didn't ask wether or not
I need a print button, but wether there is an html alternative for
javascipt.
They are not Mac only, just not IE friendly, although Sherm could easily
correct this as I have posted...

He prefers freedom?
Back to the point in hand, there is no HTML | CSS print solution for you
only JavaScript and it is very unnecessary since the browser has a Print
button and now most have Print Preview as well.

So I've learned :)

Kind Regards,
Steven
 
S

Sherm Pendley

Jonathan N. Little said:
They are not Mac only, just not IE friendly, although Sherm could
easily correct this as I have posted...

I tried your solution - it breaks in Safari. With your code, trying to
switch stylesheets in Safari results in no stylesheet at all being selected.

With Safari users at about 45% of my site's traffic, and given the fact
that Safari's lack of a built-in way to switch stylesheets is the reason
that drop-down exists to begin with, I'm not willing to break it for the
sake of the handful (<5%) of IE users that site gets.

sherm--
 
S

Sherm Pendley

Timmermans said:
A homepage link on the homepage, makes sense? Just as much as using frames.

User interface studies have shown that "moving menus" tend to confuse users.
So instead of doing that, I leave the menu and navbar layout unchanged and
highlight the current page.

The current page is not a link, and no frames are used.

sherm--
 
S

Sherm Pendley

Timmermans said:
Sherm, you say you only have 5% of IE/Win users, a self-limited amount, how
many visitors you might have if your site would be available to everyone?

The number of IE/Windows users isn't limited by the site - it's limited by
the fact that CamelBones itself, being a wrapper for Apple's Cocoa framework
for Mac programmers, is not of interest to Windows developers.
If you can't be bothered with non Mac users why not inform them in your sig
that your sites are for Mac users only

The site is *not* for Mac users only. Why do you keep repeating that lie? The
only thing IE users are missing is the ability to switch stylesheets. It's
valid, portable HTML, and the default stylesheet renders just fine in IE.

sherm--
 
J

JD

Sherm said:
The number of IE/Windows users isn't limited by the site - it's limited by
the fact that CamelBones itself, being a wrapper for Apple's Cocoa framework
for Mac programmers, is not of interest to Windows developers.


The site is *not* for Mac users only. Why do you keep repeating that lie? The
only thing IE users are missing is the ability to switch stylesheets. It's
valid, portable HTML, and the default stylesheet renders just fine in IE.

That's true: the default style looks fine in IE.

The only problem is, in IE7 at least, is that if you use the stylesheet
switcher just once (even if you simply click it without making a
selection), the site becomes unstyled and there doesn't seem to be any
way to get back the nice visuals, short of clearing the browser cache
and refreshing the page.

A quick fix might be to hide the stylesheet switcher from all versions
of IE using some filters.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top