Announcement

Collapse
No announcement yet.

screen resolution

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • screen resolution

    Hi,

    is it possible to show a certain header banner when users have screen resolution at 800x600?

    How?

    Thanks

  • #2
    Yes, using Javascript (But perhaps theres a more up-to-date version of it).

    Code:
    <script type="text/javascript">
    if (screen.width<=800)
    {
    document.write('800x600 header code here');
    }
    else
    {
    document.write('Regular header code here');
    }
    </script>

    Comment


    • #3
      where to add this code dude?

      Comment


      • #4
        You add it wherever you want it to do it's job.

        In your case, where you want your header image to be.

        Comment


        • #5
          my header is this

          Code:
          <div align="center">
          <div style="img-align: center;  overflow: hidden; background-color:#000;"><a href="http://www.interfans.org/forum"><script>
          var logo=new Array()
          logo[0]='<img src="http://img289.echo.cx/img289/5356/javier011xg.jpg" border="0" alt="Javier Zanetti" width="768"/>'
          logo[1]='<img src="http://img341.imageshack.us/img341/484/deki16pv.jpg" border="0" alt="Dejan Stankovic" width="768"/>'
          logo[2]='<img src="http://img341.imageshack.us/img341/5079/cordoba16ta.jpg" border="0" alt="Ivan Cordoba" width="768"/>'
          logo[3]='<img src="http://img331.imageshack.us/img331/6425/toldo13nt.jpg" border="0" alt="Francesco Toldo" width="768"/>'
          logo[4]='<img src="http://img326.imageshack.us/img326/9302/adri0105lc.jpg" border="0" alt="Adriano" />'
          logo[5]='<img src="http://img213.imageshack.us/img213/7223/mancio2vk.jpg" border="0" alt="Roberto Mancini" width="768"/>'
          logo[6]='<img src="http://img348.imageshack.us/img348/5818/cuchu196lp.jpg" border="0" alt="Esteban Cambiasso" width="768"/>'
          logo[7]='<img src="http://img343.imageshack.us/img343/5859/figo4cj.jpg" border="0" alt="Luis Figo" />'
          logo[8]='<img src="http://img343.imageshack.us/img343/8954/piza7yr8lt.jpg" border="0" alt="David Pizarro" width="768"/>'
          logo[9]='<img src="http://img92.imageshack.us/img92/5726/martins8rp.jpg" border="0" alt="Obafemi Martins" width="768"/>'
          logo[10]='<img src="http://img92.imageshack.us/img92/93/deki1fb.jpg" border="0" alt="Dejan Stankovic" width="768"/>'
          
          var displaylogo=Math.floor(Math.random()*(logo.length)  )
          document.write(logo[displaylogo])
          </script></a>
          the script rotate thos banner, let's say I want only 1 banner for 800x600 resolution, what should my header be with the script u gave before?

          Comment


          • #6
            Code:
            <script type="text/javascript">
            if (screen.width<=800)
            {
            document.write('<img src="/800600banner.jpg" />');
            }
            else
            {
            document.write('<div align="center">
            <div style="img-align: center;  overflow: hidden; background-color:#000;"><a href="http://www.interfans.org/forum"><script>
            var logo=new Array()
            logo[0]='<img src="http://img289.echo.cx/img289/5356/javier011xg.jpg" border="0" alt="Javier Zanetti" width="768"/>'
            logo[1]='<img src="http://img341.imageshack.us/img341/484/deki16pv.jpg" border="0" alt="Dejan Stankovic" width="768"/>'
            logo[2]='<img src="http://img341.imageshack.us/img341/5079/cordoba16ta.jpg" border="0" alt="Ivan Cordoba" width="768"/>'
            logo[3]='<img src="http://img331.imageshack.us/img331/6425/toldo13nt.jpg" border="0" alt="Francesco Toldo" width="768"/>'
            logo[4]='<img src="http://img326.imageshack.us/img326/9302/adri0105lc.jpg" border="0" alt="Adriano" />'
            logo[5]='<img src="http://img213.imageshack.us/img213/7223/mancio2vk.jpg" border="0" alt="Roberto Mancini" width="768"/>'
            logo[6]='<img src="http://img348.imageshack.us/img348/5818/cuchu196lp.jpg" border="0" alt="Esteban Cambiasso" width="768"/>'
            logo[7]='<img src="http://img343.imageshack.us/img343/5859/figo4cj.jpg" border="0" alt="Luis Figo" />'
            logo[8]='<img src="http://img343.imageshack.us/img343/8954/piza7yr8lt.jpg" border="0" alt="David Pizarro" width="768"/>'
            logo[9]='<img src="http://img92.imageshack.us/img92/5726/martins8rp.jpg" border="0" alt="Obafemi Martins" width="768"/>'
            logo[10]='<img src="http://img92.imageshack.us/img92/93/deki1fb.jpg" border="0" alt="Dejan Stankovic" width="768"/>'
            
            var displaylogo=Math.floor(Math.random()*(logo.length)  )
            document.write(logo[displaylogo])
            </script></a>');
            }
            </script>
            Should work.

            Comment


            • #7
              Originally posted by jamesyfx
              Code:
              <script type="text/javascript">
              if (screen.width<=800)
              {
              document.write('<img src="/800600banner.jpg" />');
              }
              else
              {
              document.write('<div align="center">
              <div style="img-align: center;  overflow: hidden; background-color:#000;"><a href="http://www.interfans.org/forum"><script>
              var logo=new Array()
              logo[0]='<img src="http://img289.echo.cx/img289/5356/javier011xg.jpg" border="0" alt="Javier Zanetti" width="768"/>'
              logo[1]='<img src="http://img341.imageshack.us/img341/484/deki16pv.jpg" border="0" alt="Dejan Stankovic" width="768"/>'
              logo[2]='<img src="http://img341.imageshack.us/img341/5079/cordoba16ta.jpg" border="0" alt="Ivan Cordoba" width="768"/>'
              logo[3]='<img src="http://img331.imageshack.us/img331/6425/toldo13nt.jpg" border="0" alt="Francesco Toldo" width="768"/>'
              logo[4]='<img src="http://img326.imageshack.us/img326/9302/adri0105lc.jpg" border="0" alt="Adriano" />'
              logo[5]='<img src="http://img213.imageshack.us/img213/7223/mancio2vk.jpg" border="0" alt="Roberto Mancini" width="768"/>'
              logo[6]='<img src="http://img348.imageshack.us/img348/5818/cuchu196lp.jpg" border="0" alt="Esteban Cambiasso" width="768"/>'
              logo[7]='<img src="http://img343.imageshack.us/img343/5859/figo4cj.jpg" border="0" alt="Luis Figo" />'
              logo[8]='<img src="http://img343.imageshack.us/img343/8954/piza7yr8lt.jpg" border="0" alt="David Pizarro" width="768"/>'
              logo[9]='<img src="http://img92.imageshack.us/img92/5726/martins8rp.jpg" border="0" alt="Obafemi Martins" width="768"/>'
              logo[10]='<img src="http://img92.imageshack.us/img92/93/deki1fb.jpg" border="0" alt="Dejan Stankovic" width="768"/>'
              
              var displaylogo=Math.floor(Math.random()*(logo.length)  )
              document.write(logo[displaylogo])
              </script></a>');
              }
              </script>
              Should work.
              it doesnt show any banner now
              only shows this:

              '); }

              Comment


              • #8
                Oh..

                It might be something to do with having a script tag inside a script tag. I'm useless with JS, so I dunno what makes it fail.

                Try this instead.

                Code:
                <script type="text/javascript">
                if (screen.width<=800)
                {
                document.write('<img src="/800600banner.jpg" />');
                }</script>
                <script type="text/javascript">
                var logo=new Array()
                logo[0]='<img src="http://img289.echo.cx/img289/5356/javier011xg.jpg" border="0" alt="Javier Zanetti" width="768"/>'
                logo[1]='<img src="http://img341.imageshack.us/img341/484/deki16pv.jpg" border="0" alt="Dejan Stankovic" width="768"/>'
                logo[2]='<img src="http://img341.imageshack.us/img341/5079/cordoba16ta.jpg" border="0" alt="Ivan Cordoba" width="768"/>'
                logo[3]='<img src="http://img331.imageshack.us/img331/6425/toldo13nt.jpg" border="0" alt="Francesco Toldo" width="768"/>'
                logo[4]='<img src="http://img326.imageshack.us/img326/9302/adri0105lc.jpg" border="0" alt="Adriano" />'
                logo[5]='<img src="http://img213.imageshack.us/img213/7223/mancio2vk.jpg" border="0" alt="Roberto Mancini" width="768"/>'
                logo[6]='<img src="http://img348.imageshack.us/img348/5818/cuchu196lp.jpg" border="0" alt="Esteban Cambiasso" width="768"/>'
                logo[7]='<img src="http://img343.imageshack.us/img343/5859/figo4cj.jpg" border="0" alt="Luis Figo" />'
                logo[8]='<img src="http://img343.imageshack.us/img343/8954/piza7yr8lt.jpg" border="0" alt="David Pizarro" width="768"/>'
                logo[9]='<img src="http://img92.imageshack.us/img92/5726/martins8rp.jpg" border="0" alt="Obafemi Martins" width="768"/>'
                logo[10]='<img src="http://img92.imageshack.us/img92/93/deki1fb.jpg" border="0" alt="Dejan Stankovic" width="768"/>'
                var displaylogo=Math.floor(Math.random()*(logo.length)  )
                document.write(logo[displaylogo])
                </script>
                .. If that doesnt work.. I dont really know either. =/

                Comment


                • #9
                  I get 2 banners with 800x600 under Ie

                  Comment


                  • #10
                    Hmm, okay.

                    Try this instead:

                    Code:
                    <script type="text/javascript">
                    if (screen.width<=800)
                    {
                    document.write('This is 800x600');
                    } else { 
                    var logo=new Array()
                    logo[0]='<img src="http://img289.echo.cx/img289/5356/javier011xg.jpg" border="0" alt="Javier Zanetti" width="768"/>'
                    logo[1]='<img src="http://img341.imageshack.us/img341/484/deki16pv.jpg" border="0" alt="Dejan Stankovic" width="768"/>'
                    logo[2]='<img src="http://img341.imageshack.us/img341/5079/cordoba16ta.jpg" border="0" alt="Ivan Cordoba" width="768"/>'
                    logo[3]='<img src="http://img331.imageshack.us/img331/6425/toldo13nt.jpg" border="0" alt="Francesco Toldo" width="768"/>'
                    logo[4]='<img src="http://img326.imageshack.us/img326/9302/adri0105lc.jpg" border="0" alt="Adriano" />'
                    logo[5]='<img src="http://img213.imageshack.us/img213/7223/mancio2vk.jpg" border="0" alt="Roberto Mancini" width="768"/>'
                    logo[6]='<img src="http://img348.imageshack.us/img348/5818/cuchu196lp.jpg" border="0" alt="Esteban Cambiasso" width="768"/>'
                    logo[7]='<img src="http://img343.imageshack.us/img343/5859/figo4cj.jpg" border="0" alt="Luis Figo" />'
                    logo[8]='<img src="http://img343.imageshack.us/img343/8954/piza7yr8lt.jpg" border="0" alt="David Pizarro" width="768"/>'
                    logo[9]='<img src="http://img92.imageshack.us/img92/5726/martins8rp.jpg" border="0" alt="Obafemi Martins" width="768"/>'
                    logo[10]='<img src="http://img92.imageshack.us/img92/93/deki1fb.jpg" border="0" alt="Dejan Stankovic" width="768"/>'
                    var displaylogo=Math.floor(Math.random()*(logo.length)  )
                    document.write(logo[displaylogo])
                    }
                    </script>

                    Comment


                    • #11
                      Code:
                       <script type="text/javascript">
                      if (screen.width<=800)
                      {
                      document.write('<img src="http://img289.echo.cx/img289/5356/javier011xg.jpg" border="0" alt="Javier Zanetti" width="768"/>');
                      } else { 
                      var logo=new Array()
                      logo[0]='<img src="http://img289.echo.cx/img289/5356/javier011xg.jpg" border="0" alt="Javier Zanetti" width="768"/>'
                      logo[1]='<img src="http://img341.imageshack.us/img341/484/deki16pv.jpg" border="0" alt="Dejan Stankovic" width="768"/>'
                      logo[2]='<img src="http://img341.imageshack.us/img341/5079/cordoba16ta.jpg" border="0" alt="Ivan Cordoba" width="768"/>'
                      logo[3]='<img src="http://img331.imageshack.us/img331/6425/toldo13nt.jpg" border="0" alt="Francesco Toldo" width="768"/>'
                      logo[4]='<img src="http://img326.imageshack.us/img326/9302/adri0105lc.jpg" border="0" alt="Adriano" />'
                      logo[5]='<img src="http://img213.imageshack.us/img213/7223/mancio2vk.jpg" border="0" alt="Roberto Mancini" width="768"/>'
                      logo[6]='<img src="http://img348.imageshack.us/img348/5818/cuchu196lp.jpg" border="0" alt="Esteban Cambiasso" width="768"/>'
                      logo[7]='<img src="http://img343.imageshack.us/img343/5859/figo4cj.jpg" border="0" alt="Luis Figo" />'
                      logo[8]='<img src="http://img343.imageshack.us/img343/8954/piza7yr8lt.jpg" border="0" alt="David Pizarro" width="768"/>'
                      logo[9]='<img src="http://img92.imageshack.us/img92/5726/martins8rp.jpg" border="0" alt="Obafemi Martins" width="768"/>'
                      logo[10]='<img src="http://img92.imageshack.us/img92/93/deki1fb.jpg" border="0" alt="Dejan Stankovic" width="768"/>'
                      var displaylogo=Math.floor(Math.random()*(logo.length)  )
                      document.write(logo[displaylogo])
                      }
                      </script>
                      works with Ie but not with Firefox

                      Comment


                      • #12
                        Where did you get that script? Since it does pull 2 images in IE.

                        Chris
                        "Anyone who conducts an argument by appealing to Authority
                        is not using his intelligence, he is just using his memory."
                        ~~~
                        Leonardo da Vinci

                        Comment


                        • #13
                          Strange. I got it working in Firefox before.

                          Although i'd only had logo[0], removed the rest.

                          Comment


                          • #14
                            Originally posted by jamesyfx
                            Strange. I got it working in Firefox before.

                            Although i'd only had logo[0], removed the rest.
                            the problem is with 800x600 I get 1 logo(the one set for ersolution 800x600) with Ie and this is ok, but with firefox I get the rotation of the logos set for 1024x768

                            Comment

                            widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                            Working...
                            X