making <div> a hyperlink

Discussion in 'Javascript' started by Dave, Sep 21, 2006.

  1. Dave

    Dave Guest

    I've been given a flash banner and told to make it a hyperlink.

    I tried this: <script type="text/javascript">
    Document.getElementById("flashcontent").onclick = function(){
    window.location='http://www.website.com'; }
    </script>

    but received an error stating that "Document" was undefined.

    I also tried this:


    <div class="linkdiv"
    onclick="javascript:location='http://www.website.com'"
    id="flashcontent"> which makes the white space in the <div> a hyperlink
    that works but not the flash banner.
     
    Dave, Sep 21, 2006
    #1
    1. Advertising

  2. Dave

    Dave Guest

    Thanks, Ed. I changed 'D' to 'd' in document but the result is the
    same. White space is hyperlinked. Flash banner is not. Added 'window'
    before 'document' without any effect.


    Ed Jay wrote:
    > Dave scribed:
    >
    > >I've been given a flash banner and told to make it a hyperlink.
    > >
    > >I tried this: <script type="text/javascript">
    > >Document.getElementById("flashcontent").onclick = function(){
    > >window.location='http://www.website.com'; }
    > ></script>
    > >
    > >but received an error stating that "Document" was undefined.
    > >
    > >I also tried this:
    > >
    > ><div class="linkdiv"
    > >onclick="javascript:location='http://www.website.com'"
    > >id="flashcontent"> which makes the white space in the <div> a hyperlink
    > >that works but not the flash banner.

    >
    > Is 'document' capitalized in js? I don't think so.
    >
    > Also, I ran into a similar issue with Firefox and I had to use
    > window.document.... to resolve it.
    > --
    > Ed Jay (remove 'M' to respond by email)
     
    Dave, Sep 21, 2006
    #2
    1. Advertising

  3. Dave

    VK Guest

    Dave wrote:
    > I've been given a flash banner and told to make it a hyperlink.


    I can be wrong (I'd like to be) but you may have to return the job back
    - unless you can edit the Flash itself.

    Flash movie is an event consumer by its own. It means that as soon as
    mouse goes over it, it "disappears" for the document - all events are
    trapped by Flash. So you can twist around to catch say mouseover, but
    no way to know onclick.

    AFAIK
     
    VK, Sep 21, 2006
    #3
  4. Dave

    Dave Guest

    I was afraid that might be the case. I told them to send me a .gif but
    was also wondering if I can put a clear button over it (something else
    I don't know how to do)?

    VK wrote:
    > Dave wrote:
    > > I've been given a flash banner and told to make it a hyperlink.

    >
    > I can be wrong (I'd like to be) but you may have to return the job back
    > - unless you can edit the Flash itself.
    >
    > Flash movie is an event consumer by its own. It means that as soon as
    > mouse goes over it, it "disappears" for the document - all events are
    > trapped by Flash. So you can twist around to catch say mouseover, but
    > no way to know onclick.
    >
    > AFAIK
     
    Dave, Sep 22, 2006
    #4
    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. davetichenor
    Replies:
    1
    Views:
    833
    Eliyahu Goldin
    Oct 30, 2006
  2. K Viltersten

    <div ... /> and <div ...></div>

    K Viltersten, Mar 30, 2009, in forum: ASP .Net
    Replies:
    4
    Views:
    750
  3. Ken
    Replies:
    1
    Views:
    379
    Alvin Bruney
    Aug 16, 2003
  4. Dwayne Madsen

    Q: Div A inside Div B is larger than Div B

    Dwayne Madsen, Jun 1, 2005, in forum: Javascript
    Replies:
    1
    Views:
    191
    David Dorward
    Jun 1, 2005
  5. mscir
    Replies:
    3
    Views:
    315
    Martin Honnen
    Jun 26, 2005
Loading...

Share This Page