// JP opened flex table

Click to See Complete Forum and Search --> : msgbox Javascript


Surrendermonkey
June 25th, 2002, 06:18 AM
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.)

anupam kant
June 26th, 2002, 01:20 AM
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>

Zvona
June 26th, 2002, 03:08 AM
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/showthread.php?s=&threadid=193184

Surrendermonkey
June 26th, 2002, 09:07 AM
Nice one Zvona - confirm is the fellow I was after.

Thanks.

//JP added flex table