本文发表在 rolia.net 枫下论坛<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
<script type ="text/javascript" >
function show(){
var VISA = 0;
var MC = 1;
var AE = 2;
var DISCOVER = 3;
var A = new Array(true, true, true, false);
var B = new Array(true, false, true, false);
var C = new Array(true, true, false, true);
var common_type = new Array(4);
for (var i = 0; i<4; i++){
common_type[i] = A[i] && B[i] && C[i];
}
var str = '';
if ( common_type[VISA] ) {
// VISA is the common type
str += 'VASIA ';
}
if ( common_type[MC] ) {
// MC is the common type
str += 'MC ';
}
if ( common_type[AE] ) {
// AE is the common type
str += 'AE ';
}
if ( common_type[DISCOVER] ) {
// DISCOVER is the common type
str += 'DISCOVER ';
}
document.getElementById ('result').innerText = str;
}
</script>
</head>
<body>
<input id="Button1" type="button" value="button" onclick ='show();' />
<span id='result'></span>
</body>
</html>更多精彩文章及讨论,请光临枫下论坛 rolia.net
<head>
<title>Untitled Page</title>
<script type ="text/javascript" >
function show(){
var VISA = 0;
var MC = 1;
var AE = 2;
var DISCOVER = 3;
var A = new Array(true, true, true, false);
var B = new Array(true, false, true, false);
var C = new Array(true, true, false, true);
var common_type = new Array(4);
for (var i = 0; i<4; i++){
common_type[i] = A[i] && B[i] && C[i];
}
var str = '';
if ( common_type[VISA] ) {
// VISA is the common type
str += 'VASIA ';
}
if ( common_type[MC] ) {
// MC is the common type
str += 'MC ';
}
if ( common_type[AE] ) {
// AE is the common type
str += 'AE ';
}
if ( common_type[DISCOVER] ) {
// DISCOVER is the common type
str += 'DISCOVER ';
}
document.getElementById ('result').innerText = str;
}
</script>
</head>
<body>
<input id="Button1" type="button" value="button" onclick ='show();' />
<span id='result'></span>
</body>
</html>更多精彩文章及讨论,请光临枫下论坛 rolia.net