javascript - I need to have my function repeat it self for each item in array -
i trying create button each item in array (from db). right first button work way suppose ones under nothing. i've tried many different thing can't seem work. if need more code or have question allow me know.
<html> <head> <link rel="shortcut icon" href="photos/favicon.ico" > <link rel="stylesheet" type="text/css" href="css/home.css"> <link rel="stylesheet" type="text/css" href="css/home.css"> <script type="text/javascript" src="js/jquery.js "></script> <head> <link rel="stylesheet" href="css/styles.css" /> <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/scripts.js"></script> </head> </head><div id="container" > <head> <link rel="shortcut icon" href="photos/favicon.ico" > <link rel="stylesheet" type="text/css" href="css/home.css"> <link rel="stylesheet" type="text/css" href="css/home.css"> <script type="text/javascript" src="js/jquery.js "></script> <head> <link rel="stylesheet" href="css/styles.css" /> <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/scripts.js"></script> </head> </head> <div id='header'> <header > <hr size="50px" color="#ff0000" text-align="right" value="dustin's resume" > <script type="text/javascript" src="js/jquery-1.8.1.js"></script> <script type="text/javascript" src="js/script.js"></script> <link rel='stylesheet' type='text/css' href='css/style.css' /> <div class='menu'> <img class="hover-link" id="logo3" src="photos/logo3.png" height="50px" align="left" alt="logo" > <!--<a class='hover-link'>navigation</a>--> <div class='sub'> <ul class='sub-options'> <li><a href="profile2.php?id=1"><img src="upload/142479139.jpg" width="100px" height="100px" text-align="center"/></a><br></li> <li><a href='default.php' style="text-size:30px;font-weight:bold;"><b>home</b></h3></a></li> <li><a href='about.php' style="text-size:30px;font-weight:bold;"><b>about</b></h3></a></li> <li><a href='members.php' style="text-size:30px;font-weight:bold;"><b>search</b></h3></a></li> <li><a href='contact.php' style="text-size:30px;font-weight:bold;"><b>contact</b></h3></a></li> <li><a href='update.php' style="text-size:30px;font-weight:bold;"><b>update info</b></h3></a></li> <li><a href='updatepic.php' style="text-size:30px;font-weight:bold;"><b>update pic</b></h3></a></li> <li><a href='logout.php' style="text-size:30px;font-weight:bold;"><b>logout</b></h3></a></li> </ul> </div> </div> </div> <style> #welcome { margin-top: 0px; color: #fff; font: bold, 25px; align: right; } </style> <image align="right" position='fixed' id="logo" src="upload/142479139.jpg" width="50px" height="50px"></image> <p id='welcome' align='right'>welcome back,<br></p> </header> <head> <link rel="shortcut icon" href="photos/favicon.ico" > <link rel="stylesheet" type="text/css" href="css/home.css"> <link rel="stylesheet" type="text/css" href="css/home.css"> <script type="text/javascript" src="js/jquery.js "></script> <head> <link rel="stylesheet" href="css/styles.css" /> <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/scripts.js"></script> </head> </head><aside > <div > <br> <p align="center"> <head> <link rel="stylesheet" href="css/styles.css" /> <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/scripts.js"></script> </head> <form> <div class="label_div">search people</div><br> <div class="input_container"> <input type="text" id="id" onkeyup="autocomplet()" autocomplete="off"> <ul id="list_id"></ul> </div> </form> </p> <a href="updatepic.php" alt="update picture"><image align="center" src="upload/142479139.jpg" width="150px" height="150px"></image></a> <br><br><br> <p><h3>dustin strader</h3></p> </div> </aside><body><div id="content" ><script type="text/javascript"> function setbg(color) { document.getelementbyid("styled").style.background=color }</script> </head> <table align="center" > <tr> <td padding="10px" width="600" height="200" style="background-image: url('photos/post.png'); "> <a href="profile2.php?id=1" ><image align="right" style="margin:0 50 0" src="upload/142479139.jpg" width="75px" height="75px"></a> <div align="center"><label style="margin:0 0" id="px" >damn got shit down!!!</label><br> <label style="margin:0 0; font-size:8px" id="px" >2014-06-19 03:28:36am</label><br></div> <div align="center"> <form method="post" action="default.php" > <label style="margin:0 0"> <textarea maxlength="40" name="comment" id="" onfocus="this.value=''; setbg('#ffffff');" onblur="setbg('white')">comment...</textarea> </label><br><br> <input type="hidden" name="ids" value="101" ></input> <div style=" margin:0 152px 0" align="center"> <input type="image" width="100px" height="35px" name="submits" src="photos/comment.png" alt="submit" /> <a href="vcomments.php?id=101" align="center"></a> <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script> <link rel="stylesheet" href="/resources/demos/style.css"> <script> $(document).ready(function(){ $( "#dialog" ).dialog({ autoopen: false, show: { effect: "blind", duration: 1000}, hide: { effect: "explode", duration: 1000 }}); $( ".opener" ).live('click',function() { $( "#dialog" ).dialog( "open" ); }); }); </script> </head> <image class="opener" width="100px" height="35px" src="photos/vcomment.png" > <div id="dialog" title="basic dialog"> <p> <label ><p>2014-06-19 03:28:36</p></label><br> <label ><h3>damn got shit down!!!</h3></label><br> <label ><p align="center">2014-06-20 23:59:39</p></label><br> <label ><p align="center">777777777777777</p></label><br> </p> <label ><p align="center">2014-06-20 23:53:36</p></label><br> <label ><p align="center">1111111111</p></label><br> </p> <label ><p align="center">2014-06-21 00:33:10</p></label><br> <label ><p align="center">9999999999999</p></label><br> </p> <label ><p align="center">2014-06-21 00:32:32</p></label><br> <label ><p align="center">44444444444444444</p></label><br> </p> <label ><p align="center">2014-06-20 17:23:11</p></label><br> <label ><p align="center">cccccc</p></label><br> </p> <label ><p align="center">2014-06-20 16:50:51</p></label><br> <label ><p align="center">hgjghjghj</p></label><br> </p> <label ><p align="center">2014-06-20 16:24:43</p></label><br> <label ><p align="center">ffffffff</p></label><br> </p> <label ><p align="center">2014-06-20 14:24:05</p></label><br> <label ><p align="center">jhnfgn</p></label><br> </p> <label ><p align="center">2014-06-20 14:24:00</p></label><br> <label ><p align="center">fgdfg</p></label><br> </p> <label ><p align="center">2014-06-19 04:34:09</p></label><br> <label ><p align="center">comment...</p></label><br> </p> </div> </div> </form> </div > </td> </tr> <table> </head> <table align="center" > <tr> <td padding="10px" width="600" height="200" style="background-image: url('photos/post.png'); "> <a href="profile2.php?id=1" ><image align="right" style="margin:0 50 0" src="upload/142479139.jpg" width="75px" height="75px"></a> <div align="center"><label style="margin:0 0" id="px" >i love site!!!</label><br> <label style="margin:0 0; font-size:8px" id="px" >2014-06-19 02:00:36am</label><br></div> <div align="center"> <form method="post" action="default.php" > <label style="margin:0 0"> <textarea maxlength="40" name="comment" id="" onfocus="this.value=''; setbg('#ffffff');" onblur="setbg('white')">comment...</textarea> </label><br><br> <input type="hidden" name="ids" value="100" ></input> <div style=" margin:0 152px 0" align="center"> <input type="image" width="100px" height="35px" name="submits" src="photos/comment.png" alt="submit" /> <a href="vcomments.php?id=100" align="center"></a> <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script> <link rel="stylesheet" href="/resources/demos/style.css"> <script> $(document).ready(function(){ $( "#dialog" ).dialog({ autoopen: false, show: { effect: "blind", duration: 1000}, hide: { effect: "explode", duration: 1000 }}); $( ".opener" ).live('click',function() { $( "#dialog" ).dialog( "open" ); }); }); </script> </head> <image class="opener" width="100px" height="35px" src="photos/vcomment.png" > <div id="dialog" title="basic dialog"> <p> <label ><p>2014-06-19 02:00:36</p></label><br> <label ><h3>i love site!!!</h3></label><br> <label ><p align="center">2014-06-20 23:58:13</p></label><br> <label ><p align="center">comment...</p></label><br> </p> <label ><p align="center">2014-06-20 13:44:55</p></label><br> <label ><p align="center">comment...</p></label><br> </p> <label ><p align="center">2014-06-20 13:42:38</p></label><br> <label ><p align="center">comment...</p></label><br> </p> <label ><p align="center">2014-06-19 05:12:37</p></label><br> <label ><p align="center">i kove tis</p></label><br> </p> </div> </div> </form> </div > </td> </tr> <table> </head> <table align="center" > <tr> <td padding="10px" width="600" height="200" style="background-image: url('photos/post.png'); "> <a href="profile2.php?id=25" ><image align="right" style="margin:0 50 0" src="upload/425876911.jpg" width="75px" height="75px"></a> <div align="center"><label style="margin:0 0" id="px" >today cool day.</label><br> <label style="margin:0 0; font-size:8px" id="px" >2014-06-18 03:38:45pm</label><br></div> <div align="center"> <form method="post" action="default.php" > <label style="margin:0 0"> <textarea maxlength="40" name="comment" id="" onfocus="this.value=''; setbg('#ffffff');" onblur="setbg('white')">comment...</textarea> </label><br><br> <input type="hidden" name="ids" value="92" ></input> <div style=" margin:0 152px 0" align="center"> <input type="image" width="100px" height="35px" name="submits" src="photos/comment.png" alt="submit" /> <a href="vcomments.php?id=92" align="center"></a> <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script> <link rel="stylesheet" href="/resources/demos/style.css"> <script> $(document).ready(function(){ $( "#dialog" ).dialog({ autoopen: false, show: { effect: "blind", duration: 1000}, hide: { effect: "explode", duration: 1000 }}); $( ".opener" ).live('click',function() { $( "#dialog" ).dialog( "open" ); }); }); </script> </head> <image class="opener" width="100px" height="35px" src="photos/vcomment.png" > <div id="dialog" title="basic dialog"> <p> <label ><p>2014-06-18 15:38:45</p></label><br> <label ><h3>today cool day.</h3></label><br> <label ><p align="center">2014-06-20 13:40:09</p></label><br> <label ><p align="center">55555</p></label><br> </p> </div> </div> </form> </div > </td> </tr> <table> </head> <table align="center" > <tr> <td padding="10px" width="600" height="200" style="background-image: url('photos/post.png'); "> <a href="profile2.php?id=25" ><image align="right" style="margin:0 50 0" src="upload/425876911.jpg" width="75px" height="75px"></a> <div align="center"><label style="margin:0 0" id="px" >dustin rocks</label><br> <label style="margin:0 0; font-size:8px" id="px" >2014-06-18 03:38:34pm</label><br></div> <div align="center"> <form method="post" action="default.php" > <label style="margin:0 0"> <textarea maxlength="40" name="comment" id="" onfocus="this.value=''; setbg('#ffffff');" onblur="setbg('white')">comment...</textarea> </label><br><br> <input type="hidden" name="ids" value="91" ></input> <div style=" margin:0 152px 0" align="center"> <input type="image" width="100px" height="35px" name="submits" src="photos/comment.png" alt="submit" /> <a href="vcomments.php?id=91" align="center"></a> <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script> <link rel="stylesheet" href="/resources/demos/style.css"> <script> $(document).ready(function(){ $( "#dialog" ).dialog({ autoopen: false, show: { effect: "blind", duration: 1000}, hide: { effect: "explode", duration: 1000 }}); $( ".opener" ).live('click',function() { $( "#dialog" ).dialog( "open" ); }); }); </script> </head> <image class="opener" width="100px" height="35px" src="photos/vcomment.png" > <div id="dialog" title="basic dialog"> <p> <label ><p>2014-06-18 15:38:34</p></label><br> <label ><h3>rocks</h3></label><br> <label ><p align="center">2014-06-20 13:40:16</p></label><br> <label ><p align="center">5555</p></label><br> </p> </div> </div> </form> </div > </td> </tr> <table> </div> </body> </div> </html>
as say, seems elements don't have unique id. either utilize unique id each element , declare related click event might long way, or add together class instead of id , add together click event 'live/ on' binding, i.e
$(".buttonclasss").live('click',function(){ //rest of code. });
javascript php jquery html arrays
No comments:
Post a Comment