helloise Posted July 8, 2011 Share Posted July 8, 2011 can i have the above? my code looks like this:i have this code in a foreach loop which displays a list of uniquecode links and when i click on a link the messageDiv elements must display <a href="#<?php echo $id; ?>" id="profilelink" name="profilelink" value="<?php echo $id."/".$blocked_record; ?>" onClick="viewornot('<?php echo $id."/".$blocked_record; ?>',this)"><?php echo $uniqueCode; ?></a><div id="messageDiv_<?php echo $id; ?>" style="display:none"> <form id="message_area_<?php echo $id; ?>" style="display:none"> <textarea name="message" rows="10" cols="20" id="message"></textarea> <input type="submit" value="Send" onClick='return sendmail()'> <input type="reset" value="Cancel" name="reset" onclick="cancelMsgBox()"></input> <br /> </form></div> then i have my JS for viewornot: function viewornot(blocked_status,link) { var id = blocked_status.split('/')[0]; mailid = id; var e = confirm('Do you want to view this profile?'); //some more code here if(e2) { var div=document.getElementById('messageDiv_'+id); div.style.display='block'; } return false } in the if above how can i use parent and child nodes to have messageDiv display under the link i clicked?? as it is now it just displays the messageDiv under the first link even though i clicked on the lats one???my form id is unique so is the div idplease help?thanks Link to comment Share on other sites More sharing options...
vipul20_j Posted July 8, 2011 Share Posted July 8, 2011 <div> tag can be used easily with form tag.learn about Learn about HTML <div> tag . Link to comment Share on other sites More sharing options...
thescientist Posted July 8, 2011 Share Posted July 8, 2011 can i have the above? my code looks like this:i have this code in a foreach loop which displays a list of uniquecode links and when i click on a link the messageDiv elements must display<a href="#<?php echo $id; ?>" id="profilelink" name="profilelink" value="<?php echo $id."/".$blocked_record; ?>" onClick="viewornot('<?php echo $id."/".$blocked_record; ?>',this)"><?php echo $uniqueCode; ?></a><div id="messageDiv_<?php echo $id; ?>" style="display:none"> <form id="message_area_<?php echo $id; ?>" style="display:none"> <textarea name="message" rows="10" cols="20" id="message"></textarea> <input type="submit" value="Send" onClick='return sendmail()'> <input type="reset" value="Cancel" name="reset" onclick="cancelMsgBox()"></input> <br /> </form></div> then i have my JS for viewornot: function viewornot(blocked_status,link) { var id = blocked_status.split('/')[0]; mailid = id; var e = confirm('Do you want to view this profile?'); //some more code here if(e2) { var div=document.getElementById('messageDiv_'+id); div.style.display='block'; } return false } in the if above how can i use parent and child nodes to have messageDiv display under the link i clicked?? as it is now it just displays the messageDiv under the first link even though i clicked on the lats one???my form id is unique so is the div idplease help?thanks where does e2 come from? I don't get why you are creating the mailid variable either, when you only end up using id. Are you checking for errors at all though? Link to comment Share on other sites More sharing options...
helloise Posted July 11, 2011 Author Share Posted July 11, 2011 sorted...i used span in stead of div and made sure that form id and span id stay unique, cos im in a foreach loop...works perfect now Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.