Dies ist mein erstes Mal auf diesem Board, also entschuldige ich mich, wenn ich ein wenig verloren scheinen. Ich bin auch ziemlich neu mit JavaScript, also behalte das im Hinterkopf. Ich benutze Sublime Text, wenn es hilft.jsMath und font styling
Ich möchte eine Art von Programm schreiben, das Differentialgleichungen löst. Bis jetzt habe ich nur ein Gefühl dafür, was ich zu tun habe und wie ich es tun werde. Mein Code ist so weit wie folgt:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function populate(slct1) {
var s1 = document.getElementById(slct1);
if (s1.value == "Linear First Order Differential Equation") {
var m1 = "A linear first order differential equation is one of the form: \n" + " y' + f(x)y = r(x) \n" + "Is this correct?";
if (confirm(m1))
var m11 = "In order to solve such a differential equation, we must plug in the respective values for f(x) and r(x). Click OK to advance to the next step.";
if (confirm(m11))
console.log("TestTest");
else
console.log("Test");
} else if (s1.value == "Cat2") {
var m2 = "Yes";
if (confirm(m2))
console.log("It works");
else
console.log("Still working");
} else if (s1.value == "Cat3") {
var something = "some stuff, etc.";
}
}
</script>
</head>
<body>
<h2>Differential Equations Solver v1.0</h2>
<hr />
Choose the form of the differential equation:
<select id="slct1" name="slct1" onchange="populate(this.id, 'slct2')">
<option value=""></option>
<option value="Linear First Order Differential Equation">Linear First Order Differential Equation</option>
<option value="Cat2">Cat2</option>
<option value="Cat3">Cat3</option>
</select>
<hr />
</body>
</html>
Ein paar Dinge, die ich aufklären wollte:
Wie kann ich jsMath implementieren? Vor allem mit console.log? Ich möchte nicht, dass irgendwelche Gleichungen auf die Tristesse von Sans Serif beschränkt sind.
Nachdem Sie eine lineare Diff Formel erster Ordnung ausgewählt und auf OK geklickt haben, wird die nächste Nachricht (var m11) in einer anderen Schriftart als im ersten Fenster angezeigt. Warum ist das und wie korrigiere ich es?
Hinweis aus der Zukunft: cdn.mathjax.org wird seine End-of-Life kurz vor, überprüfen https://www.mathjax.org/cdn-shutting-down/ für Migration Tipps . –