resizeing text with javascript ???? THANKS

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • uso

    resizeing text with javascript ???? THANKS

    Hi, how can I resize text on my web page. From smaller
    fonts to larger. For example, on web page I click several
    times on picture or butten or... and my text several times
    go larger, when I click on other picture it goes smaller.
    I have donn it with picture, but in this version I onley
    change the width and heigt parametars. Sorry for bad
    English. THANKS

    <script language="JavaS cript">
    function zoom(i) {
    if (i==1)
    {
    if (document.pictu re1.width<700)
    {
    document.slika1 .width=document .picture1.width *1.30
    document.slika1 .height=documen t.picture1.heig ht*1.30
    }
    }
    else
    {
    if (document.pictu re1.height>100)
    {
    document.slika1 .width=document .picture1.width *0.70
    document.slika1 .height=documen t.picture1.heig ht*0.70
    }
    }
    if (i==3)
    {
    document.pictur e1.width=350
    document.pictur e1.height=254
    }
    }
    </script>


  • David Dorward

    #2
    Re: resizeing text with javascript ???? THANKS

    uso wrote:
    [color=blue]
    > Hi, how can I resize text on my web page. From smaller
    > fonts to larger.[/color]

    Alter the CSS font-size property of the body element (assuming you haven't
    done something silly like defining font sizes for other elements in a size
    that isn't proportional to the user's preference).

    I wouldn't bother though. I'm not aware of any browser which would support
    that that doesn't come with its own facility for resizing text. Presenting
    users with UIs that duplicate existing functionality but which only work
    for your site is generally a bad idea.


    --
    David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is

    Comment

    • DU

      #3
      Re: resizeing text with javascript ???? THANKS

      uso wrote:
      [color=blue]
      > Hi, how can I resize text on my web page.[/color]

      By first choosing relative font-size unit values (like em or %). And
      then by letting the user do this himself via his browser interface.
      Duplicating the interface of the browser is usually a bad idea.

      From smaller[color=blue]
      > fonts to larger. For example, on web page I click several
      > times on picture or butten or... and my text several times
      > go larger, when I click on other picture it goes smaller.
      > I have donn it with picture, but in this version I onley
      > change the width and heigt parametars. Sorry for bad
      > English. THANKS
      >
      > <script language="JavaS cript">
      > function zoom(i) {
      > if (i==1)
      > {
      > if (document.pictu re1.width<700)[/color]

      This will only work in MSIE. Give the pictures (the <img> element) an id
      attribute value and then access these elements this way

      document.getEle mentById(idAttr Value)

      Using Web Standards in Your Web Pages
      The MDN Web Docs site provides information about Open Web technologies including HTML, CSS, and APIs for both Web sites and progressive web apps.


      [color=blue]
      > {
      > document.slika1 .width=document .picture1.width *1.30
      > document.slika1 .height=documen t.picture1.heig ht*1.30
      > }
      > }
      > else
      > {
      > if (document.pictu re1.height>100)
      > {
      > document.slika1 .width=document .picture1.width *0.70
      > document.slika1 .height=documen t.picture1.heig ht*0.70
      > }
      > }
      > if (i==3)
      > {
      > document.pictur e1.width=350
      > document.pictur e1.height=254
      > }
      > }
      > </script>
      >
      >[/color]

      DU
      --
      The site said to use Internet Explorer 5 or better... so I switched to
      Firefox 1.0.4 :)

      Comment

      • DU

        #4
        Re: resizeing text with javascript ???? THANKS

        DU wrote:
        [color=blue]
        > uso wrote:
        >[color=green]
        >> Hi, how can I resize text on my web page.[/color]
        >
        >
        > By first choosing relative font-size unit values (like em or %).[/color]


        W3C Quality Assurance tip for webmaster:
        Care With Font Size, Recommended Practices: Forget <font>, use CSS
        "Do not specify the font-size in pt, or other absolute length units.
        They render inconsistently across platforms and can't be resized by the
        User Agent (e.g browser).
        Use relative length units such as percent or (better) em, (...)"


        DU
        --
        The site said to use Internet Explorer 5 or better... so I switched to
        Firefox 1.0.4 :)

        Comment

        Working...