2010-11-09 5 views
0

J'ai un appel de fonction window.open on click, qui ouvre un album .swf.Modifier le titre de window.open

var win = null; 
function NewWindow(wizpage, wizname, w, h, scroll){ 
LeftPosition = (screen.width) ? (screen.width-w)-8 : 0; 
TopPosition = (screen.height) ? (screen.height-h)/2 : 0; 
settings = 'height=' + h + ',width=' + w + ',top= 100,' + TopPosition + ',left=' + LeftPosition + ',scrollbars=' + scroll + ',resizable'; 
win = window.open(wizpage, wizname, settings); 
} 

Je voudrais changer le titre de la fenêtre ouverte, qu'il a quelque titre significatif (un « album Player » constant ou quelque chose serait bien), de sorte que ne pas utiliser le nom de fichier par défaut/application -shockwave ... texte.

Merci pour l'aide.

Répondre

2

Essayez cette

var win = null; 
function NewWindow(wizpage, wizname, w, h, scroll){ 
    LeftPosition = (screen.width) ? (screen.width-w)-8 : 0; 
    TopPosition = (screen.height) ? (screen.height-h)/2 : 0; 
    settings = 'height=' + h + ',width=' + w + ',top= 100,' + TopPosition + ',left=' + LeftPosition + ',scrollbars=' + scroll + ',resizable'; 
    win = window.open(wizpage, wizname, settings); 
    win.document.title = "your new title"; 
} 
+0

Merci, mais malheureusement, cela ne fonctionne pas bien, pour un moment, le titre apparaît, mais il est ensuite réécrit avec le nom de swf comme avant. :-(par exemple http://mind-jart.baksagaspar.com/mindkiller/ben-garbo/ (bas, albumplayer) – Gas

8

Ensuite, il a mis à l'événement onload:

win.onload = function() { this.document.title = "your new title"; } 
0
function fnDurationPrint(displayText, dateText) { 
      var WindowObject = window.open('', "DurationText", "width=430,height=250,top=200,left=250,toolbars=no,scrollbars=yes,status=no,resizable=no"); 
      WindowObject.document.writeln("<li>" + displayText + "</li>"); 
      WindowObject.document.title = "Duration Text of " + dateText; 
     } 

//WindowObject.document.title = doit toujours être le dernier après tout le code dans la fonction javascript

Questions connexes