SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Feb 2005
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Javascript value

    Hi.
    I have try to make picture quiz with javascript. i don't use radiobutton or checkbox.


    i use form and i don't know how i put VALUE to picture?? Can anyone help me?? Did i have make new function or what?? please help newbie..

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For each piece of data you want to submit via form, you need some kind of input tag. Sounds like you need:
    <input type="hidden" name="q1" value="1"/>
    <input type="hidden" name="q2" value="2"/>
    ... etc

    Lets say you have question 1 which requires the user to click on one of 4 images - each being a possible answer. You'd have:
    <img src="image1.jpeg" onclick="document.myform.q1.value='1';"/>
    <img src="image2.jpeg" onclick="document.myform.q1.value='2';"/>
    <img src="image3.jpeg" onclick="document.myform.q1.value='3';"/>
    <img src="image4.jpeg" onclick="document.myform.q1.value='4';"/>

  3. #3
    SitePoint Member
    Join Date
    Feb 2005
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank u for that jimfraser. i think that is right thing what i need.

    Can u help me more?

    if i have blank_image and image1 how to do onmouse over? and when i push left mousebutton i select example image1. i hope someone understand

  4. #4
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if i have blank_image and image1 how to do onmouse over?
    google: "javascript rollovers"

  5. #5
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <img src="image1.jpeg" onclick="document.myform.q1.value='1';"
    onmouseover="this.src='anotherimage.jpeg';" onmouseout="this.src='image1.jpeg';"/>


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
  •