geekisthenewsexy Posted November 1, 2010 Share Posted November 1, 2010 hi there guys, i am currently working on this code and was wondering why it won't work on IE and only on FF..my FF's version is 3.6.8 and version 7 on IE.. here is the code i am working on <img src="images/magnifier.png" alt="View rooms" width="16" height="16" onClick="window.open(\'viewroom.php?course='.$row['c_name'].'&year='.$row['year'].'&id='.$row['b_id'].'&block='.$row['block'].'\',\'View rooms\',\'width=350, height=200, menubar=yes\')"/> i don't know if it's okay to put the onclick inside this img tag but so far, it's okay and works on FF.. now what's confusing for me is all the img tags like this one doesn't seem to work in FF except for delete which works both on my FF and IE here's the code <img src="images/del.png" alt="Delete rooms" width="16" height="16" href="delete.php?course='. $row['c_name'].'" onClick="return confirm(\'You are about to delete this record! Delete?\');"/> okay, if you think it's lacking ; i've already tried that but it still won't work. i hope you guys can help.. :-\ Quote Link to comment https://forums.phpfreaks.com/topic/217404-onclick-inside-img-tag-wont-work-on-ie-help-please/ Share on other sites More sharing options...
michaellunsford Posted November 5, 2010 Share Posted November 5, 2010 Looks like you're escaping single-quotes. Are you using PHP to deliver this, or is this as it renders in html? I'd want to see the unescaped finished html to make sure there aren't any syntax errors. Also, why not just use an <a> tag and just include "return false;" after your window.open()? Also, in most modern non-quirks mode html, I believe onclick is all lowercase - although most browsers probably won't hold you to it. <a href="somelink.html" onclick="window.open(this.href,'_blank'); return false;"><img src="whatever.jpg" alt="" /></a> Quote Link to comment https://forums.phpfreaks.com/topic/217404-onclick-inside-img-tag-wont-work-on-ie-help-please/#findComment-1130536 Share on other sites More sharing options...
geekisthenewsexy Posted November 6, 2010 Author Share Posted November 6, 2010 hi there, thanks for the response michaellunsford. yup, i'm using php on this one. i have already placed it inside the <a> tag like you said. i just didn't do it in the first place because i didn't like having a border on the image, but it's okay now. all it took was border="0". Also, why not just use an <a> tag and just include "return false;" after your window.open()? that's the funny thing, i did that already and it still won't work.. here's the complete code of the images view rooms <a href="#" onClick="window.open(\'viewroom.php?id='.$row['b_id'].'&block='.$row['block'].'\',\'View rooms\',\'width=350, height=350, menubar=yes\'); return false;"><img src="images/magnifier.png" width="16" height="16" border="0" alt="View rooms" ></a> add rooms <a href="#" onClick="window.open(\'room.php?id='.$row['b_id'].'&block='.$row['block'].'\',\'Add rooms\',\'width=300, height=300, menubar=yes\'); return false;"><img src="images/add.png" width="16" height="16" border="0" alt="Add rooms"></a> edit <a href="#" onClick="window.open(\'edit.php?course='.$row['c_name'].'&year='.$row['year'].'&id='.$row['b_id'].'&block='.$row['block'].'\',\'Edit\',\'width=500, height=250, menubar=yes\'); return false;"><img src="images/edit.png" alt="Edit block" width="16" height="16" border="0"></a> delete <a href="delete.php?course='.$row['c_name'].'&year='.$row['year'].'&block='.$row['block'].'" onClick="return confirm(\'You are about to delete course='.$row['c_name'].' year='.$row['year'].' block='.$row['block'].'! Delete?\'); return false;"><img src="images/del.png" width="16" height="16" border="0" alt="Delete record"></a> there..i've placed this inside the php echo by the way.. Quote Link to comment https://forums.phpfreaks.com/topic/217404-onclick-inside-img-tag-wont-work-on-ie-help-please/#findComment-1130990 Share on other sites More sharing options...
.josh Posted November 6, 2010 Share Posted November 6, 2010 please post the code that actually outputs the images, not just the images themselves (like the echo "...."; or whatever) Quote Link to comment https://forums.phpfreaks.com/topic/217404-onclick-inside-img-tag-wont-work-on-ie-help-please/#findComment-1131028 Share on other sites More sharing options...
geekisthenewsexy Posted November 8, 2010 Author Share Posted November 8, 2010 oh okay,sorry for that.. here echo '<td align="center"><div id="imagealign"> <div><a href="#" onClick="window.open(\'viewroom.php?id='.$row['b_id'].'&block='.$row['block'].'\',\'View rooms\',\'width=350, height=350, menubar=yes\');return false;"><img src="images/magnifier.png" alt="View rooms" width="16" height="16" border="0"></a> <a href="#" onClick="window.open(\'room.php?id='.$row['b_id'].'&block='.$row['block'].'\',\'Add rooms\',\'width=300, height=300, menubar=yes\'); return false;"><img src="images/add.png" alt="Add rooms" width="16" height="16" border="0"></a> | <a href="#" onClick="window.open(\'edit.php?c_id='.$row['c_id'].'&course='.$row['c_name'].'&y_id='.$row['y_id'].'&year='.$row['year'].'&id='.$row['b_id'].'&block='.$row['block'].'\',\'Edit\',\'width=500, height=200, menubar=yes\');return false;"><img src="images/edit.png" alt="Edit block" width="16" height="16" border="0"></a> <a href="delete.php?c_id='.$row['c_id'].'&course='.$row['c_name'].'&y_id='.$row['y_id'].'&year='.$row['year'].'&b_id='.$row['b_id'].'&block='.$row['block'].'" onClick="return confirm(\'You are about to delete '.$row['c_name'].', '.$row['year'].', '.$row['block'].'! Delete?\');return false;"><img src="images/del.png" width="16" height="16" border="0" alt="Delete record"></a></div></div></td>'; echo "</tr>"; Quote Link to comment https://forums.phpfreaks.com/topic/217404-onclick-inside-img-tag-wont-work-on-ie-help-please/#findComment-1131600 Share on other sites More sharing options...
.josh Posted November 8, 2010 Share Posted November 8, 2010 Okay well the only thing I can really see wrong is for your first 2 links, the 2nd argument for window.open() has a space in it ("View rooms" and "Add rooms"). In IE, you can't have a space. Quote Link to comment https://forums.phpfreaks.com/topic/217404-onclick-inside-img-tag-wont-work-on-ie-help-please/#findComment-1131709 Share on other sites More sharing options...
geekisthenewsexy Posted November 12, 2010 Author Share Posted November 12, 2010 solved! thanks Crayon Violent! Quote Link to comment https://forums.phpfreaks.com/topic/217404-onclick-inside-img-tag-wont-work-on-ie-help-please/#findComment-1133328 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.