php with javascript

Discussion in 'PHP' started by mirosoft1, Oct 8, 2008.

  1. #1
    hi all
    i made a php page on it function with javascript to swap two images
    and then i call this function on php code put it is not working

    code
    <SCRIPT LANGUAGE=JavaScript>
    intImage = 2;
    function swapImage() {
    switch (intImage) {
    case 1:
    IMG1.src = "b_no.JPG"
    intImage = 2
    return(false);
    case 2:
    IMG1.src = "b_ok.JPG"
    intImage = 1
    return(false);
    }
    }
    </SCRIPT>

    php:::::
    while ($threads = mysql_fetch_array($tr)) {
    echo "<td> <IMG id='IMG1' name='IMG1' src='b_no.JPG'
    onclick='swapImage();'></td>";


    i want help plzzz
     
    mirosoft1, Oct 8, 2008 IP
  2. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #2
    based on your javascript, php can do it alone

    convert you js function to a php function
     
    bartolay13, Oct 8, 2008 IP
  3. mirosoft1

    mirosoft1 Well-Known Member

    Messages:
    110
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #3
    how i canot undersatand???
     
    mirosoft1, Oct 8, 2008 IP
  4. mirosoft1

    mirosoft1 Well-Known Member

    Messages:
    110
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #4
    can you give me the code because i tried it and not working
     
    mirosoft1, Oct 8, 2008 IP