This is a discussion on PHP Dynamic data in CSS Pop Up got but just one. within the PHP General forums, part of the PHP Programming Forums category; Hi, I am trying to create a dynamic table. Which is working fine. On the onclick event of one of ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi, I am trying to create a dynamic table. Which is working fine. On the onclick event of one of the hyperlink in a field (called Details) a small css pop up opens. THis works fine when I have just one row. But in case I have more than one rows the Details link comes Hyperlinked but when I click on the link it opens the css pop up at just one location. You can try this here. <html> <head> <title>A Test</title> <script language="javascript"> function toggleLayer(whichLayer) { if (document.getElementById) { // this is the way the standards work var style2 = document.getElementById(whichLayer).style; style2.display = style2.display? "":"block"; } else if (document.all) { // this is the way old msie versions work var style2 = document.all[whichLayer].style; style2.display = style2.display? "":"block"; } else if (document.layers) { // this is the way nn4 works var style2 = document.layers[whichLayer].style; style2.display = style2.display? "":"block"; } } </script> <style> div#commentForm { margin: 0px 20px 0px 20px; display: none; } </style> <body><table><tr><td> <div id="commentForm">Beti </div> javascript:toggleLayer('commentForm'); Add a comment <input type="reset" name="reset" value="Cancel" onclick="javascript:toggleLayer('commentForm');" /></td><td><div id="commentForm" >Beti </div> javascript:toggleLayer('commentForm'); Add a comment <input type="reset" name="reset" value="Cancel" onclick="javascript:toggleLayer('commentForm');" /></td></tr></table> </body> How to open separate window for separate rows with the data specific to that row only. I am using the Id in php to retrieve the data. Thanks in advance. -- View this message in context: http://www.nabble.com/PHP-Dynamic-da....html#a9076992 Sent from the PHP - General mailing list archive at Nabble.com. |
|
|||
|
Chris Carter wrote:
> Hi, > > I am trying to create a dynamic table. Which is working fine. On the onclick > event of one of the hyperlink in a field (called Details) a small css pop up > opens. THis works fine when I have just one row. But in case I have more > than one rows the Details link comes Hyperlinked but when I click on the > link it opens the css pop up at just one location. You can try this here. > > .... > <input type="reset" name="reset" value="Cancel" > onclick="javascript:toggleLayer('commentForm');" /></td><td><div > id="commentForm" >Beti the 'id' attribute must be unique within your page - that is part of the (x)HTML spec ... which provides you with a clue. > </div> javascript:toggleLayer('commentForm'); > Add a comment > > <input type="reset" name="reset" value="Cancel" > onclick="javascript:toggleLayer('commentForm');" /></td></tr></table> > </body> > > How to open separate window for separate rows with the data specific to that > row only. I am using the Id in php to retrieve the data. I have no idea what 'Id' is exactly but it's another clue to your solution: echo '<div id="commentForm',$Id,'">'; // etc // etc echo "onclick=\"javascript:toggleLayer('commentForm",$I d,"');\""; // etc the value of $Id must change for every row of data you are outputting. > > Thanks in advance. |
|
|||
|
Thats great! I would try that as a solution. However, I am not sure if everytime a seperate div would open at the location of the row. For example, if I have data in the first row that row gets hyperlinked and the Div can be opened on the first row. After the first row at least 20 rows are grayed out coz there is not data. Now, when I click on the 21st row for the data, it opens up the first row only and not at the location of 21st row. Thats one thing I am facing right now. Thanks again. Jochem Maas wrote: > > Chris Carter wrote: >> Hi, >> >> I am trying to create a dynamic table. Which is working fine. On the >> onclick >> event of one of the hyperlink in a field (called Details) a small css pop >> up >> opens. THis works fine when I have just one row. But in case I have more >> than one rows the Details link comes Hyperlinked but when I click on the >> link it opens the css pop up at just one location. You can try this here. >> >> > > ... > >> <input type="reset" name="reset" value="Cancel" >> onclick="javascript:toggleLayer('commentForm');" /></td><td><div >> id="commentForm" >Beti > > the 'id' attribute must be unique within your page - that is part of the > (x)HTML spec ... which provides you with a clue. > >> </div> javascript:toggleLayer('commentForm'); >> Add a comment >> >> <input type="reset" name="reset" value="Cancel" >> onclick="javascript:toggleLayer('commentForm');" /></td></tr></table> >> </body> >> >> How to open separate window for separate rows with the data specific to >> that >> row only. I am using the Id in php to retrieve the data. > > I have no idea what 'Id' is exactly but it's another clue to your > solution: > > echo '<div id="commentForm',$Id,'">'; // etc > // etc > echo "onclick=\"javascript:toggleLayer('commentForm",$I d,"');\""; // etc > > the value of $Id must change for every row of data you are outputting. >> >> Thanks in advance. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- View this message in context: http://www.nabble.com/PHP-Dynamic-da....html#a9077374 Sent from the PHP - General mailing list archive at Nabble.com. |
|
|||
|
Chris Carter wrote:
> Thats great! I would try that as a solution. However, I am not sure if > everytime a seperate div would open at the location of the row. For example, > if I have data in the first row that row gets hyperlinked and the Div can be > opened on the first row. After the first row at least 20 rows are grayed out > coz there is not data. Now, when I click on the 21st row for the data, it > opens up the first row only and not at the location of 21st row. Thats one > thing I am facing right now. you control which element gets displayed by generating/setting the correct DOM element id attribute in the HTML you generate with php (i.e. the 'details' link in row 21 will display the popup div that corresponds to row 21) ... where the element gets displayed in nothing to do with php, you determine where on the page to display something using suitable HTML and/or CSS - this is no longer a php problem - I believe you need to take this question to a more suitable list/forum/thing. > > Thanks again. > > > Jochem Maas wrote: >> Chris Carter wrote: >>> Hi, >>> >>> I am trying to create a dynamic table. Which is working fine. On the >>> onclick >>> event of one of the hyperlink in a field (called Details) a small css pop >>> up >>> opens. THis works fine when I have just one row. But in case I have more >>> than one rows the Details link comes Hyperlinked but when I click on the >>> link it opens the css pop up at just one location. You can try this here. >>> >>> >> ... >> >>> <input type="reset" name="reset" value="Cancel" >>> onclick="javascript:toggleLayer('commentForm');" /></td><td><div >>> id="commentForm" >Beti >> the 'id' attribute must be unique within your page - that is part of the >> (x)HTML spec ... which provides you with a clue. >> >>> </div> javascript:toggleLayer('commentForm'); >>> Add a comment >>> >>> <input type="reset" name="reset" value="Cancel" >>> onclick="javascript:toggleLayer('commentForm');" /></td></tr></table> >>> </body> >>> >>> How to open separate window for separate rows with the data specific to >>> that >>> row only. I am using the Id in php to retrieve the data. >> I have no idea what 'Id' is exactly but it's another clue to your >> solution: >> >> echo '<div id="commentForm',$Id,'">'; // etc >> // etc >> echo "onclick=\"javascript:toggleLayer('commentForm",$I d,"');\""; // etc >> >> the value of $Id must change for every row of data you are outputting. >>> Thanks in advance. >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> >> > |