spero di non sbagliare postando qui..
ho da poco modificato una pagina html che era stata validata da validator.w3.org come conforme agli standard html 4.0
a questa pagina ho aggiunto un javascript per il detect automatico del flash player che mi sta creando non pochi problemi, in quanto non è più conforme agli standard html 4.0
la riga di codice che crea questi problemi è la seguente:
document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
validator.w3.org mi dice che il tag <SRC non è chiuso correttamente, siccome non conosco javascript, non so nemmeno da dove cominciare per sistemarlo.
di seguito riporto lo script completo.
ringrazio anticipatamente
Samuel
#########################################
<head>
<script type="text/javascript">
<!--
function SymError()
{
return true;
}
window.onerror = SymError;
//-->
</SCRIPT>
<SCRIPT type=text/javascript>
var requiredVersion = 6;
var useRedirect = true;
var flashPage = "flashpage.htm"
var noFlashPage = "noflash.htm"
var upgradePage = "noflash.htm"
var flash2Installed = false;
var flash3Installed = false;
var flash4Installed = false;
var flash5Installed = false;
var flash6Installed = false;
var maxVersion = 6;
var actualVersion = 0;
var hasRightVersion = false;
var jsVersion = 1.0;
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;
jsVersion = 1.1;
if(isIE && isWin){
document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
document.write('on error resume next \n');
document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFl ash.2"))) \n');
document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFl ash.3"))) \n');
document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFl ash.4"))) \n');
document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFl ash.5"))) \n');
document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFl ash.6"))) \n');
document.write('</SCR' + 'IPT\> \n');
}
function showMain(flashpg) {
var URLen=flashpg;
var windowNamen="mainwindow";
var browserName=navigator.appName;
var operatingSystem=navigator.platform;
var version = parseFloat(navigator.appVersion);
if (browserName.indexOf("Netscape")!=-1 && version>=4.0 && operatingSystem.indexOf("Mac")!=-1)
{
window.open(URLen,windowNamen,'titlebar=no,top=0,l eft=0,width=' + window.screen.availWidth+',height='+window.screen. availWidth+',screenX=0,screenY=0,top=0,left=0')
}
else if (browserName.indexOf("Microsoft Internet Explorer")!=-1 && operatingSystem.indexOf("Mac")!=-1)
{
window.open(URLen,windowNamen,'titlebar=no,top=0,l eft=0,width=' + window.screen.availWidth+',height='+window.screen. availWidth+',screenX=0,screenY=0,top=0,left=0')
}
else if (browserName.indexOf("Netscape")!=-1 && operatingSystem.indexOf("Mac")!=-1)
{
window.open(URLen,windowNamen,'width='+screen.widt h+',height='+screen.height+',top=0,left=0');
}
else if (browserName.indexOf("Microsoft Internet Explorer")!=-1 && operatingSystem.indexOf("Win")!=-1)
{
var win = window.open(URLen,windowNamen,'titlebar=0,toolbar= 0,location=0,directories=0,status=0,menubar=0,scro llbars=0,resizable=0,top=0,left=0,width=' + window.screen.availWidth+',height='+window.screen. availHeight+',screenX=0,screenY=0,top=0,left=0')
win.resizeTo(screen.width, screen.height);
}
else if (browserName.indexOf("Netscape")!=-1 && operatingSystem.indexOf("Win")!=-1)
{
window.open(URLen,windowNamen,'width='+screen.widt h+',height='+screen.height+',top=0,left=0');
}
else
{
window.open(URLen,windowNamen);
}
}
function detectFlash() {
if (navigator.plugins) {
if (navigator.plugins["Shockwave Flash 2.0"]
|| navigator.plugins["Shockwave Flash"]) {
var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
var flashVersion = parseInt(flashDescription.charAt(flashDescription. indexOf(".") - 1));
flash2Installed = flashVersion == 2;
flash3Installed = flashVersion == 3;
flash4Installed = flashVersion == 4;
flash5Installed = flashVersion == 5;
flash6Installed = flashVersion >= 6;
}
}
for (var i = 2; i <= maxVersion; i++) {
if (eval("flash" + i + "Installed") == true) actualVersion = i;
}
if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 3;
if (actualVersion >= requiredVersion) {
if (useRedirect) {
if(jsVersion > 1.0) {
showMain(flashPage);
} else {
window.location = flashPage;
}
}
hasRightVersion = true;
} else {
if (useRedirect) {
if(jsVersion > 1.0) {
window.location.replace((actualVersion >= 2) ? upgradePage : noFlashPage);
} else {
window.location = (actualVersion >= 2) ? upgradePage : noFlashPage;
}
}
}
}
</SCRIPT>
</head>
####################################