owen.aaron Posted June 14, 2007 Share Posted June 14, 2007 hello all, I have an issue with a js popup running on my php page. I did manage to get it working but basically i had to stop the php with a ?>, insert my js script tags, and parse as html until my first picture where i se upt the onmouseover and onmouseout calls. once this is done I then started php again and parsed the rest of the page with php so my sql calls would run. The big issue I see is that for each property I have i want up to 5 pictures displayed and i plan on having the names of the images stored in the DB so i can dynamically insert them. I want this js popup to happen on all of those pictures as well but i dont see that happening if I cant run the js in php. Hopefully I explained this enough for you all to understand what Im trying to do. I was getting unexpected Tstring errors so it may be the right combination of "" and '' Im missing. the code follows. to view the working page kerseyre.com/sectioned_lots2.php one of my sql calls for the properties. (once I get this figured out i will be replacing coming soon in the pictures table with image/austinsacres/$fetch[picture1] $austin_query=mysql_query("SELECT * FROM Property WHERE type='Sectioned' AND subdiv='Austins Acres' ORDER by lot_number"); if (mysql_errno()) echo "Error: " . mysql_error(); while($fetch=@mysql_fetch_array($austin_query)) { $austin.=" <tr><td width='50' bgcolor='8BA446' align='center'>$fetch[lot_number]</td><td width='80' bgcolor='8BA446' align='right'>$fetch[acreage] Acres</td><td width='100' bgcolor='8BA446' align='right'>$fetch[price]</td><td width='125' bgcolor='8BA446' align='left'>Coming soon!</td></tr>"; my beginning html and first table. as you can see I had to stop parsing php to get the js working. </html> <head></head> <body bgcolor='FEF1B5'>"; ?> <script language="javascript" type="text/javascript" src="http://www.esolutions-pc.com/includes/js/overlib_mini.js"></script> <script language="javascript" type="text/javascript" src="http://www.esolutions-pc.com/includes/js/overlib_hideform_mini.js"></script> <script language="Javascript"> <!-- function showInfo(name, dir) { var pattern = /\b \b/ig; name = name.replace(pattern,'_'); name = name.toLowerCase(); var src = 'http://www.kerseyre.com/images/'+dir+'/map_popup.png'; var html=name; html = '<br /><img border="1" src="'+src+'" name="imagelib" alt="No preview available" width="600" height="450" />'; return overlib(html, CAPTION, name) } --> </script> <center> <table border='1' cellpadding='0' cellspacing='1' bordercolor='4F4F2F'> <tr> <td colspan='4' bgcolor='458B00' align='center' cellpadding='0'><a href='images/austinsacres/full_map.jpg' onmouseover="showInfo('Austins Acres','austinsacres')" onmouseout="return nd();" target='_blank'><img src='images/austinsacres/map_thumb.png' align='left'></a><div style='font-size:24;font-weight: bold; color: #ccc;' >Austins Acres</div></td> </tr> <tr> <td width='50' bgcolor='8BA446' align='center'>Lot #</td> <td width='75' bgcolor='8BA446' align='center'>Acreage</td> <td width='100' bgcolor='8BA446' align='center'>Price</td> <td width='125' bgcolor='8BA446'>Pictures</td> </tr> <?php print " $austin </table><br><br> Quote Link to comment Share on other sites More sharing options...
Corona4456 Posted June 14, 2007 Share Posted June 14, 2007 Well... whether you do it with "" or '' you'll have to make sure and escape the proper character. So if you are using "" then you'll have to escape every " in the string and if you are using '' you'll have to escape every ' in the string. Quote Link to comment Share on other sites More sharing options...
owen.aaron Posted June 14, 2007 Author Share Posted June 14, 2007 I guess to refine my issue a bit more I will show you what Ive tried. I have moved the print " above the start of my first tabl where the example image is. <?php print " <center> <table border='1' cellpadding='0' cellspacing='1' bordercolor='4F4F2F'> <tr> <td colspan='4' bgcolor='458B00' align='center' cellpadding='0'><a href='images/austinsacres/full_map.jpg' onmouseover="showInfo('Austins Acres','austinsacres')" onmouseout="return nd();" target='_blank'><img src='images/austinsacres/map_thumb.png' align='left'></a><div style='font-size:24;font-weight: bold; color: #ccc;' >Austins Acres</div></td> </tr> <tr> <td width='50' bgcolor='8BA446' align='center'>Lot #</td> <td width='75' bgcolor='8BA446' align='center'>Acreage</td> <td width='100' bgcolor='8BA446' align='center'>Price</td> <td width='125' bgcolor='8BA446'>Pictures</td> </tr> these are the two lines Im having issues with, they give the unexpected t_string error because of the quotes. onmouseover="showInfo('Austins Acres','austinsacres')" onmouseout="return nd();"[code] I have tried... [code]onmouseover=showInfo('Austins Acres','austinsacres') onmouseout=return nd(); and [/code]onmouseover='showInfo('Austins Acres','austinsacres')' onmouseout='return nd();'[/code] In both cases the error is gone and the page loads but the JS doest run. Im not sure how to correct this. Quote Link to comment Share on other sites More sharing options...
Corona4456 Posted June 14, 2007 Share Posted June 14, 2007 onmouseover="showInfo('Austins Acres','austinsacres')" onmouseout="return nd();" Should be: onmouseover=\"showInfo('Austins Acres','austinsacres')\" onmouseout=\"return nd();\" Quote Link to comment Share on other sites More sharing options...
owen.aaron Posted June 14, 2007 Author Share Posted June 14, 2007 Dude thats sweet, it works fine now. what exactly are the / for? why were they needed to work? Quote Link to comment Share on other sites More sharing options...
Corona4456 Posted June 14, 2007 Share Posted June 14, 2007 It's an escape character. http://www.phpnoise.com/tutorials/25/3 Quote Link to comment Share on other sites More sharing options...
owen.aaron Posted June 15, 2007 Author Share Posted June 15, 2007 Ahh, I had never heard that term before. Thanks again! Quote Link to comment 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.