Infatti qualcosa è fattibile. E' solo un esempio.
Mettere i due files nella stessa cartella.
File : test100a.html
Codice PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<script language="JavaScript" type="text/javascript">
<!--
function pippo() {
textToCompare = document.getElementById('my_text').value;
if (document.frames != null) {
var inputTags = document.frames('my_frame').document.getElementsByTagName('input');
} else {
var inputTags = document.getElementById('my_frame').contentWindow.document.getElementsByTagName('input');
}
conta = inputTags.length;
cliccato = false;
for (i=0;i<conta;i++) {
var curInput = inputTags[i];
if (curInput.type.toUpperCase() == ('button').toUpperCase() && curInput.value.toUpperCase() == textToCompare.toUpperCase()) {
cliccato = true;
curInput.click();
} // if (curInput.type.toUpperCase() == ('button').toUpperCase() && .....
} // for (i=0;i<conta;i++)
if (!cliccato) {
alert("Nessun bottone trovato con il testo '"+textToCompare+"'");
} // if (!cliccato)
} // function pippo()
//-->
</script>
</head>
<body>
<iframe src="test100b.html" id="my_frame" name="my_frame" height="400" width="600" ></iframe>
<br/><br/>
Immettere il testo del bottone da cliccare :
<input type="text" id="my_text" value='Tre' /><input type="button" value="Invio" onclick="pippo()"/>
</body>
</html>
File : test100b.html
Codice PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
Sono il frame.<br>
<input type="button" value="Uno" id="my_button1" onclick="document.getElementById('my_div1').style.display='inline'"/>
<div id="my_div1" style="display:none">
Messaggio da bottone Uno => Mi hai cliccato !!!
</div>
<br/><br/>
<input type="button" value="Due" id="my_button2" onclick="document.getElementById('my_div2').style.display='inline'"/>
<div id="my_div2" style="display:none">
Messaggio da bottone Due => Mi hai cliccato !!!
</div>
<br/><br/>
<input type="button" value="Tre" id="my_button3" onclick="document.getElementById('my_div3').style.display='inline'"/>
<div id="my_div3" style="display:none">
Messaggio da bottone Tre => Mi hai cliccato !!!
</div>
<br/><br/>
<input type="button" value="Uno" id="my_button4" onclick="document.getElementById('my_div4').style.display='inline'"/>
<div id="my_div4" style="display:none">
Messaggio da bottone Uno => Mi hai cliccato !!!
</div>
</body>
</html>