Jago6060 Posted June 9, 2007 Share Posted June 9, 2007 I'm trying to pull images from a database and apply some JavaScript functions to them(mouseovers). here is the code I have. my functions... <script language = "Javascript" type = "text/javascript"> function imgEnlarge(){ document.getElementById('img').height += 100 document.getElementById('img').width += 100 } function imgShrink(){ document.getElementById('img').height -= 100 document.getElementById('img').width -= 100 } </script> and heres my php... <? include 'connect.php'; $tdcount = 0; @mysql_select_db($database) or die( "Unable to select database"); $sql = "SELECT * FROM images"; $result=mysql_query($sql); $num=mysql_numrows($result); mysql_close(); echo "<table border=0 align=center cellspacing=10 cellpadding=10><tr>"; $i=0; while ($i < $num) { $d1=mysql_result($result,$i,"id"); $d2=mysql_result($result,$i,"dir"); $img_dim = getimagesize($d2); $num_img = array(1=>'128','176','320','352','550','640','704','720','768','800','1024'); $width = ($img_dim[0]); $height = ($img_dim[1]); $count = 0; do {$count++; $width = ($img_dim[0]/$count); $height = ($img_dim[1]/$count); } while (($width > 75) && ($height > 75)); echo "<td><a href=$d2><img src=$d2 id=img border=0 width=$width height=$height onmouseover=imgEnlarge onmouseout=imgShrink></a></td>"; $tdcount++; $i++; if ($tdcount == 4){ echo "</tr>"; $tdcount = 0; } } echo "</table>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/54900-integrating-javascriptwith-phphaving-some-issues/ Share on other sites More sharing options...
dymon Posted June 9, 2007 Share Posted June 9, 2007 Hi, what is really the problem, something doen't work? Dymon Quote Link to comment https://forums.phpfreaks.com/topic/54900-integrating-javascriptwith-phphaving-some-issues/#findComment-271520 Share on other sites More sharing options...
Jago6060 Posted June 10, 2007 Author Share Posted June 10, 2007 oops, yeah sorry I forgot to list the issue. When the images appear on the screen, the functions don't work. but I have the exact same functions on my local computer that work. I think it's how I have the PHP image echo line setup but I'm not sure. I guess I kind of need a second set of eyes to see whats wrong. Quote Link to comment https://forums.phpfreaks.com/topic/54900-integrating-javascriptwith-phphaving-some-issues/#findComment-271653 Share on other sites More sharing options...
soycharliente Posted June 10, 2007 Share Posted June 10, 2007 Try adding quotes around your attribute values and giving your functions ()'s. Quote Link to comment https://forums.phpfreaks.com/topic/54900-integrating-javascriptwith-phphaving-some-issues/#findComment-271655 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.