|
function CopyClip( strName ) {
var objTarget;
var objPre;
var range;
objTarget = document.getElementById( strName );
objPre = objTarget.getElementsByTagName( "PRE" );
if ( document.all ) {
window.clipboardData.setData(
"Text", objPre[0].innerText
);
}
else {
if ( getFlashVarsion() <= 6 ) {
alert("Flash のバージョン7以上が必要です");
return;
}
range = document.createRange();
range.selectNode( objPre.item(0) );
setClipboard( range.toString() );
}
window.status = "クリップボードへコピーしました";
}
function setClipboard( strValue ) {
var obj;
if ( document.all ) {
obj = document.getElementById("flash1");
}
else {
obj = document.getElementById("flash2");
}
obj.SetVariable("commandType", "setClipboard");
obj.SetVariable("paramValue", strValue );
obj.Play();
}
function getFlashVarsion() {
var objFlash,i;
var description,flashPlugin;
if ( document.all ) {
for( i = 10; i >= 5; i-- ) {
try {
objFlash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i );
break;
}
catch( e ) {
if ( i == 5 ) {
i = 0;
break;
}
}
}
}
else {
i = 0;
if ( navigator.plugins && navigator.plugins.length > 0) {
flashPlugin = navigator.plugins['Shockwave Flash'];
if (typeof flashPlugin == 'object') {
description = flashPlugin.description;
for( i = 10; i > 4; i-- ) {
if (description.indexOf(i+'.') != -1) {
break;
}
}
if ( i == 4 ) {
i = 0;
}
}
}
}
return i;
}
| |