Hi is there a way to pass iframe id ... php to javascript

in php my code
PHP Code:
echo "<iframe name='messageTxt' id ='" $e "' src='" $e "' style='display:block'></iframe><input type='button' value='Import' onClick='init()' />"
Produce:

Code:
<iframe name='messageTxt' id ='../resumes/20130412092633.txt' src='../resumes/20130412092633.txt' style='display:block'></iframe><input type='button' value='Import' onClick='init()' /><iframe name='messageTxt' id ='../resumes/20130412111328.txt' src='../resumes/20130412111328.txt' style='display:block'></iframe><input type='button' value='Import' onClick='init()' />
So as you could see the iframe name is the same but id is changing...I want to onClick be able to load specific txt file in the same iframe on the page

my javascript code is

Code:
<script type="text/javascript">	
	function init(){
		var extText = window.frames.messageTxt.document.body.lastChild.lastChild.data;
		var firstLine = extText.split('\n')[0];
		var secondLine = extText.split('\n')[2];
		var forthLine = extText.split('\n')[3];
		document.forms[0].newstext.value = forthLine;  
		document.forms[0].title.value = firstLine;
		document.forms[0].name.value = secondLine;	
	}
</script>
As i see it must be something with
Code:
window.frames.messageTxt.document.body.lastChild.lastChild.data;
Thanks for the help