24-01-2005, 22:29
|
|
|
|
חבר מתאריך: 06.10.04
הודעות: 1,337
|
|
קודם כל
VBscript ו VB אותו דבר בדיוק....
אתה בוחר איזה לחצנים אתה רוצה
לדוגמא כאן בחרתי בשני לחצנים, Yes ו No
עכשיו, יש לך שתי אפשרויות לדעת מה הוא לחץ
1. ליצור משתנה גלובלי בשם כלשהוא, מסוג מספר (integer) ולכתוב בצורה:
קוד:
Dim Answer As Integer
Answer = msgbox("Do you want to quit?",VbYesNo )
If (Answer = 6) then
Msgbox("You Chose Yes")
else
Msgbox("You Chose No")
end if
עכשיו לגבי ה"6" אלה הערכים למרבית האפשרויות שיש ב VB- 1 = vbOK - OK was clicked
- 2 = vbCancel - Cancel was clicked
- 3 = vbAbort - Abort was clicked
- 4 = vbRetry - Retry was clicked
- 5 = vbIgnore - Ignore was clicked
- 6 = vbYes - Yes was clicked
- 7 = vbNo - No was clicked
האפשרות השניה היא לכתוב את זה בצורה הבאה ללא משתנה גלובלי:
קוד:
If (MsgBox("Do you want to quit?", vbYesNo) = vbYes) Then
MsgBox ("Yes")
Else
MsgBox ("No")
End If
זה ב VB, הקוד ב VBSctipt הוא
קוד:
function que If (MsgBox("Do you want to quit?", vbYesNo) = vbYes) Then MsgBox ("Yes") Else MsgBox ("No") End Ifend functionfunction que If (MsgBox("Do you want to quit?", vbYesNo) = vbYes) Then MsgBox ("Yes") Else MsgBox ("No") End Ifend functionfunction que If (MsgBox("Do you want to quit?", vbYesNo) = vbYes) Then MsgBox ("Yes") Else MsgBox ("No") End Ifend function<script language=VBScript>
function que
If (MsgBox("Do you want to quit?", vbYesNo) = vbYes) Then
MsgBox ("Yes")
Else
MsgBox ("No")
End If
end function
</script> function que If (MsgBox("Do you want to quit?", vbYesNo) = vbYes) Then MsgBox ("Yes") Else MsgBox ("No") End Ifend function
וב BODY נגיד לשים כפתור רגיל
<INPUT type="button" value="Button" id=button1 name=button1 onclick=que>
סבבה?
תגיד לי אם עזרתי.....
_____________________________________
נערך לאחרונה ע"י ryan ariel levi בתאריך 24-01-2005 בשעה 22:36.
סיבה: לגבי VBScript
|