JavaScript/תסריטים: הבדלים בין גרסאות בדף

תוכן שנמחק תוכן שנוסף
Crazy Ivan (שיחה | תרומות)
מ קטגוריה
←‏בדיקת טופס: עוד שימוש ב <syntaxhighlight>
שורה 5:
 
== פונקציית random (בין 0 ל-M פחות 1) ==
<syntaxhighlight lang="javascript">
<blockquote style="border: 1px solid blue; padding: 2em;">
<div style="direction: ltr;">
function GRN(max,min)
{ return Math.floor(Math.random()*(max-min+1))+min; }
 
</syntaxhighlight>
{return Math.floor(Math.random()*(max-min+1))+min;}
</div>
</blockquote>
 
== סקריפט להדפסת תאריך ושעה ==
<syntaxhighlight lang="javascript">
<div style="direction: ltr;">
document.write("עיצוב הטקסט ב-html"+Date()+"ביטול של עיצוב הטקסט")
</syntaxhighlight>
</div>
לדוגמא:
<syntaxhighlight lang="javascript">
<blockquote style="border: 1px solid blue; padding: 2em;">
<div style="direction: ltr;">
document.write("כלשהו p כאן יהיה רשום"+Date()+"<\/p>")
</syntaxhighlight>
</div>
</blockquote>
 
== פונקציה המשתמשת במערך ==
<syntaxhighlight lang="javascript">
<blockquote style="border: 1px solid blue; padding: 2em;">
<div style="direction: ltr;">
function alert_an_option()
 
{
var A_rand=GRN(3);
 
var A_randNew_array=GRNnew Array(3);
New_array[10]="Option 21";
 
var New_array[1]=new"Option Array(3)2";
New_array[2]="Option 3";
 
alert(New_array[0A_rand]="Option 1");
 
New_array[1]="Option 2";
 
New_array[2]="Option 3";
 
alert(New_array[A_rand]);
 
}
</syntaxhighlight>
</div>
</blockquote>
 
== ראה גם ==