SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Mar 2001
    Location
    Harrisburg, Pa - USA
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    is this possible to do with a form?

    what i have is a basic form, with the text fields and all, but i want to make the submit button not an image, but an image map

    is that possible? maybe this can be done with javascript?


    if it isnt possible, i assume its possible to use a standard image for a submit button by using the src="picture.jpg" inside the input tags for the submit button


    thanks!
    icq: 79493534
    x3designs.net

  2. #2
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I don't see why not. Simply direct each map area to the same function and submit from the function. something like:

    function sendIt(mapInfo, formObj)
    {
    if (mapInfo == 'something')
    {
    dothis();
    dothat();
    formObj.action = 'something';
    formObj.submit()
    }
    else
    {
    dothis();
    formObj.action = 'somethingelse';
    formObj.submit()
    }
    }

    where 'formObj' is the form object --> document.formName;

    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still

  3. #3
    SitePoint Member
    Join Date
    Mar 2001
    Location
    Harrisburg, Pa - USA
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sorry, im still fairly new when it comes to javascript

    if i understand correctly, what you put is made for different image maps, however if i only needed this for one image map, could i do:

    function sendit(formObj) {
    formObj.submit()
    }

    and then id just link the image map to like "javascript:sendit(document.formname)"



    does that make any sense? or did i miss the boat on something


    once again, thanks Vincent !
    icq: 79493534
    x3designs.net

  4. #4
    What? Maelstrom's Avatar
    Join Date
    Oct 2001
    Location
    Whistler BC originally from Guelph Ontario
    Posts
    2,175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Make a regular image map with the correct references
    Code:
    <img src="file:///C|/phpdev/www/public/salomon.jpg" usemap="#Map" border="0"> 
    <map name="Map">
      <area shape="rect" coords="1,0,131,97" href="javascript:void(0)" onclick="sendIt(document.form1)">
      <area shape="rect" coords="131,1,289,94" href="javascript:void(0)" onclick="sendIt(document.form2)">
      <area shape="rect" coords="134,97,285,207" href="#">
      <area shape="rect" coords="1,101,136,200" href="#">
    </map>
    That is what I got from what Vinny wrote.
    Of course continue the code into the other mappings. Although I am unsure as to what Vinny means by map info.

    Vinny- are you saying to apply an id or name to each 'map' and call the function with that name or id?
    Maelstrom Personal - Apparition Visions
    Development - PhP || Mysql || Zend || Devshed
    Unix - FreeBSD || FreeBsdForums || Man Pages
    They made me a sitepoint Mentor - Feel free to PM me or Email me and I will see if I can help.

  5. #5
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Yay!! miscommunication!!! Ok. let's start over.

    Tony D:
    I thought you want to have each area send the form to a different location. If that is the case, Maelstrom's solution is close to what I meant. If you want the entire image map to be used as one link -- <a href...><img src..><map..><area..>...</a> -- try and see. But I suspect you will -- at the least -- be unable to access whatever hrefs are in the area tags.

    Maelstrom:

    Yes, either an id or an identifying value that would work with either if/else or a switch statement.

    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still


Bookmarks

Posting Permissions

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