deadlyp99 Posted August 19, 2009 Share Posted August 19, 2009 Well I've posted a lot of questions lately, and I try to give back by helping others. But today I have another question I have a image map with coordinates, and it also updates a <span> with the #'s I assign via php. $x and $y both have an initial value of 0. <area shape="poly" coords="304,112,267,131,305,152,340,132" alt="1,0" onmouseover="document.getElementById("x").innerHTML="'.$Xarray[$x].'";document.getElementById("y").innerHTML="'.$Yarray[$y].'";" href="?x='.$Xarray[$x].'&y='.$Yarray[$y].'" /> <area shape="poly" coords="304,112,267,131,305,152,340,132" alt="1,0" onmouseover="document.getElementById("x").innerHTML="'.$Xarray[$x++].'";document.getElementById("y").innerHTML="'.$Yarray[$y].'";" href="?x='.$Xarray[$x++].'&y='.$Yarray[$y].'" /> Now when I print_r($Xarray), I get the correct stuff (36, 37, 38, etc). In addition, the link of the image on the second area does increase like it should, to 37. However the javascript mouse over does not increment. So when I look at the source code on the page I see: <area shape="poly" coords="267,91,230,111,269,131,303,112" alt="0,0" onmouseover="document.getElementById('x').innerHTML='36';document.getElementById('y').innerHTML='-4';" href="?x=36&y=-4" /> <area shape="poly" coords="304,112,267,131,305,152,340,132" alt="1,0" onmouseover="document.getElementById('x').innerHTML='36';document.getElementById('y').innerHTML="-4';" href="?x=37&y=-4" /> Notice the "36" and the "37" on the bottom area? That's my problem. I'm not sure what's causing it, but help would be greatly appreaciated. Thanks for your time. If it becomes needed, I'll fill more area map fields to see if it is an ongoing problem. But I really don't want to have to go through mass amounts of fixing line by line with the same repetive change so I started with just these 2 boxes. Quote Link to comment https://forums.phpfreaks.com/topic/170920-solved-x-is-working-half-ish/ Share on other sites More sharing options...
Zane Posted August 19, 2009 Share Posted August 19, 2009 you've told us the problem pretty well...but what's your question. yes I see the 36 and 37..what is odd about it. Quote Link to comment https://forums.phpfreaks.com/topic/170920-solved-x-is-working-half-ish/#findComment-901485 Share on other sites More sharing options...
deadlyp99 Posted August 19, 2009 Author Share Posted August 19, 2009 Well now that I have thought of it I made more then one error in my logic, but it doesnt bring me to a solution. In my head I want my Javascript, followed by the link to print out like so: JS 36 -4, Link 36 -4 JS 37 -4, Link 37 -4 JS 38 -4, Link 38 -4 JS 39 -4, Link 39 -4 But I just realized this error how following the logic it should be printed $Xarray = (36, 37, 38, 39, 40, 41, 42); $Yarray = (-4, -5, -6, -7, -8, -9, -10); JS 36 -4, Link 36 -4 JS 37 -4, Link 38 -4 JS 39 -4, Link 40 -4 JS 41 -4, Link 42 -4 Since the first item in teh array is 36, the first $x++ should bring it to 37, and the second $x++ 38 correct? I can fix the second by removing the "++", but the code isnt operating how i'm thinking it should I guess To be as clear as I can, I want the javascript event, and the href, to have the same value per line, so that the link matches the javascript coordinate being displayed. Quote Link to comment https://forums.phpfreaks.com/topic/170920-solved-x-is-working-half-ish/#findComment-901491 Share on other sites More sharing options...
deadlyp99 Posted August 19, 2009 Author Share Posted August 19, 2009 I'm an idiot lol. I was completly over-doing it <area shape="poly" coords="304,112,267,131,305,152,340,132" alt="1,0" onmouseover="document.getElementById("x").innerHTML="'.$Xarray[0].'";document.getElementById("y").innerHTML="'.$Yarray[0].'";" href="?x='.$Xarray[0].'&y='.$Yarray[0].'" /> <area shape="poly" coords="304,112,267,131,305,152,340,132" alt="1,0" onmouseover="document.getElementById("x").innerHTML="'.$Xarray[1].'";document.getElementById("y").innerHTML="'.$Yarray[0].'";" href="?x='.$Xarray[1].'&y='.$Yarray[0].'" /> So simple -.- Quote Link to comment https://forums.phpfreaks.com/topic/170920-solved-x-is-working-half-ish/#findComment-901535 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.