10-03-2005, 14:30
|
|
|
חבר מתאריך: 23.10.04
הודעות: 299
|
|
משהו מעניין שנתקלתי איתו בJavaScript
כתבתי את הקוד הבא:
קוד:
<html>
<head>
<script language="JavaScript">
alert("Exmple");
var color = prompt("What color do you more like? red/blue?" , "Type red/blue")
if (color == "red")
{
document.writeln ("<font color="red">" + "i see you like red!" + "</font>")
}
if (color == "blue")
{
document.writeln ("<font color="blue">" + "i see you like blue!" + "</font>")
}
</script>
</head>
</html>
הקוד לא עבד לי, התפלאתי כי ראיתי שהכל רשום בסדר, ואז סתם ניסיתי להחליף לגרשיים במקום גרשיים כפולים בתגית ה<font>, ועשיתי <font color='red'> במקום <font color="red">, וזה פעל לי!
אפשר לדעת למה הקוד לא פעל עם הגרשיים הכפולים?
|