Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
  1. #1
    Member web101's Avatar
    Join Date
    Jan 2009
    Posts
    74
    Member #
    18165
    Hey guys and gals, I need some clarification. I have this code here..

    HTML Code:
    <area onclick="document.getElementById('states').innerHTML='HI'"; shape="poly" coords="532,77,522,52,525,51,527,47,526,38,525,29,528,18,532,20,536,15,541,18,546,34,560,45" href="#me" />
    That goes along with a map. When you click on a state (like in this case, Maine), the text "Hi" shows up in a box below the map. Now that all works perfectly fine but I want to be able to have links inside the innerHTML part like...

    HTML Code:
    <area onclick="document.getElementById('states').innerHTML='<a href="hi.html">HI</a> <a href="bye.html">BYE</a>'"; shape="poly" coords="532,77,522,52,525,51,527,47,526,38,525,29,528,18,532,20,536,15,541,18,546,34,560,45" href="#me" />
    But that code doesn't work. Is there any way to put multiple links inside of the innerHTML part? Any help will be greatly appreciated Thanks!

  2.  

  3. #2
    Senior Member Karloff's Avatar
    Join Date
    Oct 2005
    Posts
    744
    Member #
    11702
    maybe your not escaping the quotes?

    http://www.htmlgoodies.com/beyond/ja...le.php/3470891

  4. #3
    Member web101's Avatar
    Join Date
    Jan 2009
    Posts
    74
    Member #
    18165
    So I'm still confused, what would the final code look like? Would I use a / at all? I'm a real noob when it comes to this so clarification would be great. Thanks for the help!

  5. #4
    Senior Member Karloff's Avatar
    Join Date
    Oct 2005
    Posts
    744
    Member #
    11702
    HTML Code:
    <area onclick="document.getElementById('states').innerHTML='<a href=\"hi.html\">HI</a> <a href=\"bye.html\">BYE</a>'"; shape="poly" coords="532,77,522,52,525,51,527,47,526,38,525,29,528,18,532,20,536,15,541,18,546,34,560,45" href="#me" />
    just a quick guess tho


    EDIT: ignore me, I didn't clearly read your code, what I said is totally wrong...

  6. #5
    Member web101's Avatar
    Join Date
    Jan 2009
    Posts
    74
    Member #
    18165
    Alright, I tried that out and it didn't end up working. This is what showed up when previewed in a browser...

    http://pxlcreations.com/error.png

  7. #6
    Member web101's Avatar
    Join Date
    Jan 2009
    Posts
    74
    Member #
    18165
    Ok, no problem, what would work?

    EDIT: ignore me, I didn't clearly read your code, what I said is totally wrong...

  8. #7
    Senior Member Karloff's Avatar
    Join Date
    Oct 2005
    Posts
    744
    Member #
    11702
    well the first step would be to put it into a function and then call that from the onclick

  9. #8
    Member web101's Avatar
    Join Date
    Jan 2009
    Posts
    74
    Member #
    18165
    Hmm, that's what another guy said to do. How would I go about adding a function?

  10. #9
    Senior Member Karloff's Avatar
    Join Date
    Oct 2005
    Posts
    744
    Member #
    11702

  11. #10
    Member web101's Avatar
    Join Date
    Jan 2009
    Posts
    74
    Member #
    18165
    Well I tried putting that into what I have so far and came up with this, but it dindn't work...

    HTML Code:
    <area onclick="function states(){document.getElementById('states').innerHTML = '<a href="hi">Hi<a/>';}"; shape="poly" coords="532,77,522,52,525,51,527,47,526,38,525,29,528,18,532,20,536,15,541,18,546,34,560,45" href="#me" />
    So what am I doing wrong?


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search tags for this page

a href innerhtml

,
get href innerhtml
,
href inner html
,
href inside href
,
href javascript innerhtml
,
html onclick link innerhtml
,
innerhtml and href
,

innerhtml href

,
javascript a href function innerhtml
,
javascript href innerhtml
Click on a term to search for related topics.
All times are GMT -6. The time now is 05:23 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com