Help with an IMAGE as a link for a popup.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Chrisjc
    Contributor
    • Nov 2006
    • 375

    Help with an IMAGE as a link for a popup.

    Here is the code for the image

    [HTML]
    <tr>
    <td style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #000000">
    <p align="center">
    <img border="0" src="http://www.afefilters. com/images/prodryslogo.gif " width="167" height="62"></td>
    </tr>
    [/HTML]

    The code that I made for the pop up is as followed...

    Code:
    <p><span onclick='loadPage("http://afefilters.com/prodrys/")'></span></p>
    Now the code that goes in the head to make this work is here.

    Code:
    <script type="text/javascript">
    function loadPage(URL) {
      var hi = screen.availHeight * 0.9;
      var wi = screen.availWidth  * 0.6;
      var str = "height=" + hi + ",width=" + wi;     
      if (window.screen) {
        var ah = screen.availHeight - 40;
        var aw = screen.availWidth - 7;
        var xc = (aw - wi) / 2;
        var yc = (ah - hi) / 2;
        str += ",left=" + xc + ",top=" + yc ;
        str += ",resizable=yes,scrollbars=yes";
      }
      win=window.open(URL, '', str); 
    }
    </script>
    <style>
      span:visited{text-decoration:none; color:#293d6b; }
      span:hover{text-decoration:underline; color:#293d6b; }
      span {margin:0 0 0 10px;color:#293d6b; cursor: hand; width:85px;}
    </style>
    Now the first code is the PICTURE it has NO LINK.. I need to make it open that link in the code I wrote in the 2nd code box... so it will pop up in the 3rd code box size that I have as well... any help please?

    I cant seem to get the IMAGE to become a link...
  • drhowarddrfine
    Recognized Expert Expert
    • Sep 2006
    • 7434

    #2
    IE6 doesn't work with :hover on any element but <a>. IE7 will but you must have a proper doctype so IE isn't in quirks mode.

    Comment

    • AricC
      Recognized Expert Top Contributor
      • Oct 2006
      • 1885

      #3
      What's up with boosting my avatar?

      Comment

      • Chrisjc
        Contributor
        • Nov 2006
        • 375

        #4
        Originally posted by AricC
        What's up with boosting my avatar?

        Boost? I leeted this off my own comp haha

        Comment

        • ronverdonk
          Recognized Expert Specialist
          • Jul 2006
          • 4259

          #5
          Originally posted by drhowarddrfine
          IE6 doesn't work with :hover on any element but <a>. IE7 will but you must have a proper doctype so IE isn't in quirks mode.
          Yes it definitely works on a span tag. It should, because I gave him that code! Try it out for yourself.

          Ronald :cool:

          Comment

          • ronverdonk
            Recognized Expert Specialist
            • Jul 2006
            • 4259

            #6
            chrisjc: why should the image behave like a link? It is not defined as a link, just some image in a cell in a table.

            Ronald :cool:

            Comment

            • drhowarddrfine
              Recognized Expert Expert
              • Sep 2006
              • 7434

              #7
              Originally posted by ronverdonk
              Yes it definitely works on a span tag. It should, because I gave him that code! Try it out for yourself.

              Ronald :cool:
              Ronald,
              :hover has not worked in IE since IE4. At least it only worked on anchors. It has been fixed in IE7 and MS made a big deal of this on their IEBlog. Even so, it's not perfect. Link

              Comment

              • ronverdonk
                Recognized Expert Specialist
                • Jul 2006
                • 4259

                #8
                Where was I? Stupid of me, but of course you are right! This hover was not supposed to work with IE6. Sorry for this.

                Ronald :cool:

                Comment

                • Chrisjc
                  Contributor
                  • Nov 2006
                  • 375

                  #9
                  I am on IE7. I am trying to make a picture a link.. because if they hover over it.. I want them to be able to click it and open in a new window... you gave me the Header code... and I want to use that as well

                  Comment

                  • drhowarddrfine
                    Recognized Expert Expert
                    • Sep 2006
                    • 7434

                    #10
                    Then just make your picture an anchor:

                    <a><img src="...."></img></a>

                    Comment

                    • Chrisjc
                      Contributor
                      • Nov 2006
                      • 375

                      #11
                      Originally posted by drhowarddrfine
                      Then just make your picture an anchor:

                      <a><img src="...."></img></a>

                      soo this is my code that makes the window open in a popup... now I need it to be a picture... that I have that when they click on it... the code below will OPEN the popup window... soo how does the code you supplyed work?

                      Code:
                      <a onclick='loadPage("http://afefilters.com/prodrys/")'></a>

                      I see it will display an image but... I know how to do that... just need the IMAGE TO BE A LINK ... any ideas?

                      Comment

                      • Chrisjc
                        Contributor
                        • Nov 2006
                        • 375

                        #12
                        Originally posted by drhowarddrfine
                        Then just make your picture an anchor:

                        <a><img src="...."></img></a>

                        wouldnt it be??

                        Code:
                        <a onclick='loadPage("http://afefilters.com/prodrys/")'><img src="...."></img></a>

                        ????

                        Comment

                        • drhowarddrfine
                          Recognized Expert Expert
                          • Sep 2006
                          • 7434

                          #13
                          If you are using javascript, yes. I thought you were just wanting a link for the image.

                          Comment

                          • Chrisjc
                            Contributor
                            • Nov 2006
                            • 375

                            #14
                            Originally posted by drhowarddrfine
                            If you are using javascript, yes. I thought you were just wanting a link for the image.

                            Yeah I am..

                            I have an IMAGE on a page.. that I want people to beable to click that IMAGE and it open a LINK that is in a NEW page but I am using a popup script so I can set the size of the new window... but I cant seem to get the picture to be link able.. here is the code I tryed but it does not work at all

                            Code:
                            <a href="<span onclick='loadPage("http://afefilters.com/prodrys/")'><img border="0" src="http://www.afefilters.com/images/prodryslogo.gif" width="167" height="62"></a></a></span>">

                            Comment

                            • AricC
                              Recognized Expert Top Contributor
                              • Oct 2006
                              • 1885

                              #15
                              Will this help?
                              JS
                              Code:
                              function OpenWindow(Url) 
                                          {
                              		        WindowOpen = window.open(Url, "", "width=675,height=480")
                                          }
                              HTML
                              Code:
                              <a href="javascript:OpenWindow('../images/4.jpg')">
                                                  <img style="width: 150px" src="../images/4.jpg" />
                                                  </a>

                              Comment

                              Working...