Reputation: 123
What I did in JS:
<script type="text/javascript">
function displayThesis(){
var thesisForm = document.getElementById("thesisForm").innerHTML;
document.getElementById("activeForm").innerHTML = thesisForm;
}
function displayNonThesis(){
var nonThesisForm = document.getElementById("nonThesisForm").innerHTML;
document.getElementById("activeForm").innerHTML = nonThesisForm;
}
</script>
then later i would do something such as:
<form action="" method="get">
<p>Do you need the thesis option form?</p>
<label>Yes</label>
<input name="thesisOption" type="radio" value="Yes" onclick="displayThesis()" />
<label>No</label>
<input name="thesisOption" type="radio" onclick="displayNonThesis()" />
</form>
to call those functions.
How would i do this with an external dart program that is listed and called with:
<script type="application/dart" src="attempt1.dart"></script>
Upvotes: 1
Views: 514
Reputation: 40492
It's forbidden in Dart. Inline event listeners is bad idea anyway. It's much better to separate HTML and script code. You can attach event listeners from dart code:
document.query('input[name="thesisOption"][value="Yes"]').on.click.add( (e) {
document.query("#activeForm").innerHTML = document.query("#thesisForm").innerHTML;
});
Of source, you should add significant class names and ids to elements to refer to them clearly.
Upvotes: 4