Jump to content

form tag within a div tag?


helloise

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...