|
-
June 25th, 2002, 05:18 AM
#1
msgbox Javascript
Hi gurus.
Simple question - I have alert();, which is fine, I have prompt();, which is fine, but how can I duplicate msgbox("whatever", vbYesNo) in javascript?
I just want to give my users an opportunity to confirm or cancel a delete.
Any help always gratefully accepted.
Cheers,
S. Monkey (Mr.)
-
June 26th, 2002, 12:20 AM
#2
MsgBox in Javascript
yes javascript has no MsgBox like functionality. still you can use VBScript MsgBox in JS.
Refer this cade:
<SCRIPT LANGUAGE=vbscript>
function callMsgBox2(strMsg)
'second parameter is msgBox type
callMsgBox2 = msgBox(strMsg,1)
end function
</SCRIPT>
<SCRIPT LANGUAGE=javascript>
<!--
function callMsgBox1(strMsg)
{
var retVal = callMsgBox2(strMsg)
}
// call this javascript function instead of alert/confirm
callMsgBox1('This is message box.!')
//-->
</SCRIPT>
Anupam.
-
June 26th, 2002, 02:08 AM
#3
Personally, I don't recommend using VBScript at all, if you're not certain what kind of environment end-user has.
Javascript has 3 functions for dialog boxes :
window.alert() for informational dialogs
window.prompt() for text-input dialog
window.confirm() for yes/no dialog
If you need to do a dialog window with custom content (like yes/no/i'm not sure/just cancel buttons), you should read thread :
http://www.codeguru.com/forum/showth...hreadid=193184
Zvona - First aid for client-side web design
-
June 26th, 2002, 08:07 AM
#4
Thanks
Nice one Zvona - confirm is the fellow I was after.
Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|