Convert javascript print-tag to html

Discussion in 'HTML' started by Timmermans, May 12, 2007.

  1. Timmermans

    Timmermans Guest

    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
     
    Timmermans, May 12, 2007
    #1
    1. Advertising

  2. Timmermans wrote:
    > 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

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, May 12, 2007
    #2
    1. Advertising

  3. "Timmermans" <> writes:

    > 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--

    --
    Web Hosting by West Virginians, for West Virginians: http://wv-www.net
    Cocoa programming in Perl: http://camelbones.sourceforge.net
     
    Sherm Pendley, May 12, 2007
    #3
  4. Timmermans

    Timmermans Guest

    "Sherm Pendley" <> wrote in message
    news:-www.com...
    > "Timmermans" <> writes:
    >
    >> 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?


    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


    > sherm--
    >
    > --
    > Web Hosting by West Virginians, for West Virginians: http://wv-www.net
    > Cocoa programming in Perl: http://camelbones.sourceforge.net
     
    Timmermans, May 12, 2007
    #4
  5. Timmermans

    Timmermans Guest

    "Jonathan N. Little" <> wrote in message
    news:8fac2$46452398$40cba7bc$...
    > Timmermans wrote:
    >> 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


    Jonathan,

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

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

    Thanks.

    Regards,
    Steven
     
    Timmermans, May 12, 2007
    #5
  6. "Timmermans" <> writes:

    > 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--

    --
    Web Hosting by West Virginians, for West Virginians: http://wv-www.net
    Cocoa programming in Perl: http://camelbones.sourceforge.net
     
    Sherm Pendley, May 12, 2007
    #6
  7. ..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
     
    Michael Fesser, May 12, 2007
    #7
  8. Timmermans

    Timmermans Guest

    "Sherm Pendley" <> wrote in message
    news:-www.com...
    > "Timmermans" <> writes:
    >
    >> 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--


    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
     
    Timmermans, May 12, 2007
    #8
  9. Sherm Pendley wrote:
    > "Timmermans" <> writes:
    >
    >> btw, your 'select a style' feature on camelbones doesn't work
    >> crossbrowser... now that's something the users don't need!


    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>
    </select>


    >
    > 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 ;-)

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, May 12, 2007
    #9
  10. "Jonathan N. Little" <> writes:

    > Sherm Pendley wrote:
    >> "Timmermans" <> writes:
    >>
    >>> btw, your 'select a style' feature on camelbones doesn't work
    >>> crossbrowser... now that's something the users don't need!

    >
    > 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--

    --
    Web Hosting by West Virginians, for West Virginians: http://wv-www.net
    Cocoa programming in Perl: http://camelbones.sourceforge.net
     
    Sherm Pendley, May 12, 2007
    #10
  11. "Timmermans" <> writes:

    > 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--

    --
    Web Hosting by West Virginians, for West Virginians: http://wv-www.net
    Cocoa programming in Perl: http://camelbones.sourceforge.net
     
    Sherm Pendley, May 12, 2007
    #11
  12. Sherm Pendley wrote:

    > 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.

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, May 12, 2007
    #12
  13. Timmermans

    Timmermans Guest

    "Sherm Pendley" <> wrote in message
    news:-www.com...
    > "Timmermans" <> writes:
    >
    >> 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.


    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
     
    Timmermans, May 13, 2007
    #13
  14. Timmermans

    Timmermans Guest

    "Sherm Pendley" <> wrote in message
    news:-www.com...
    > "Jonathan N. Little" <> writes:
    >
    >> Sherm Pendley wrote:
    >>> "Timmermans" <> writes:
    >>>
    >>>> btw, your 'select a style' feature on camelbones doesn't work
    >>>> crossbrowser... now that's something the users don't need!

    >>
    >> 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--
    >
    > --
    > Web Hosting by West Virginians, for West Virginians: http://wv-www.net
    > Cocoa programming in Perl: http://camelbones.sourceforge.net


    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
     
    Timmermans, May 13, 2007
    #14
  15. Timmermans wrote:

    > 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.

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, May 13, 2007
    #15
  16. Timmermans

    Timmermans Guest

    "Jonathan N. Little" <> wrote in message
    news:b330f$4646730a$40cba7a3$...
    > Timmermans wrote:
    >
    >> 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!


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

    >> 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...


    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.

    >> 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...


    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 :)

    > --
    > Take care,
    >
    > Jonathan
    > -------------------
    > LITTLE WORKS STUDIO
    > http://www.LittleWorksStudio.com


    Kind Regards,
    Steven
     
    Timmermans, May 13, 2007
    #16
  17. "Jonathan N. Little" <> writes:

    > 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--

    --
    Web Hosting by West Virginians, for West Virginians: http://wv-www.net
    Cocoa programming in Perl: http://camelbones.sourceforge.net
     
    Sherm Pendley, May 13, 2007
    #17
  18. "Timmermans" <> writes:

    > "Jonathan N. Little" <> wrote in message
    > news:b330f$4646730a$40cba7a3$...
    >> Timmermans wrote:
    >>
    >>> 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!

    >
    > 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--

    --
    Web Hosting by West Virginians, for West Virginians: http://wv-www.net
    Cocoa programming in Perl: http://camelbones.sourceforge.net
     
    Sherm Pendley, May 13, 2007
    #18
  19. "Timmermans" <> writes:

    > 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--

    --
    Web Hosting by West Virginians, for West Virginians: http://wv-www.net
    Cocoa programming in Perl: http://camelbones.sourceforge.net
     
    Sherm Pendley, May 13, 2007
    #19
  20. Timmermans

    JD Guest

    Sherm Pendley wrote:
    > "Timmermans" <> writes:
    >
    >> 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.


    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.
     
    JD, May 13, 2007
    #20
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. RC
    Replies:
    2
    Views:
    455
    Malte
    May 10, 2005
  2. shruds
    Replies:
    1
    Views:
    938
    John C. Bollinger
    Jan 27, 2006
  3. Replies:
    1
    Views:
    423
    Andrew Thompson
    Nov 29, 2006
  4. keto
    Replies:
    0
    Views:
    1,043
  5. David Cournapeau

    print a vs print '%s' % a vs print '%f' a

    David Cournapeau, Dec 30, 2008, in forum: Python
    Replies:
    0
    Views:
    399
    David Cournapeau
    Dec 30, 2008
Loading...

Share This Page