Click to See Complete Forum and Search --> : how do i change the title of a window?


senn
02-06-2003, 10:53 AM
hi, my website is at http://www.purpletequila.com
when you click on the main picture, a flash window will popup, i want the title to display the text "PurpleTequila.com" instead of "http://www.purpletequila.com/purple.swf".

I'm using window.open to open the flash window, how can i change the title?

below is the code in index.htm

<html>
<head>
<title>PurpleTequila.com</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="666666" text="ffffff" link="#CCCCCC" vlink="#CCCCCC" alink="#CCCCCC">
<p align="center"><a href="javascript:PurpleTequila()"><img src="intropix.jpg" width="600" height="200" border="0"></a></p>
<p align="center"><font face="Geneva, Arial, Helvetica, san-serif" size="1">get
ready, download <a href="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank">FLASH</a></font></p>
<p align="center"><img src="/cgi-sys/Count.cgi?df=count.dat|display=Counter|ft=0|md=10|frgb=0;0;0|dd=E"></p>

<script language="JavaScript">
function PurpleTequila() {
NewWin=window.open('purple.swf','PurpleTequila','toolbar=no,scrollBars=auto,resizable=no,status=no,w idth=800,height=600');
}
</script>

</body>
</html>

khalidali63
02-06-2003, 10:59 AM
use the window reference object to write your on title.

NewWin.document.title="any value here"

this hsould work.

Khalid

senn
02-06-2003, 11:10 AM
i believe i'm suppose to add that line there?
but it doesnt work...

<script language="JavaScript">
function PurpleTequila() {
NewWin=window.open('purple.swf','PurpleTequila','location=0,menubar=0,directories=0,toolbar=0,scroll Bars=auto,resizable=0,status=0,width=800,height=600');

NewWin.document.title="PurpleTequila.com";

}
</script>

khalidali63
02-06-2003, 11:27 AM
Interesting

replace the function with this


<script language="JavaScript">
function PurpleTequila() {
NewWin=window.open('','PurpleTequila','location=0,menubar=0,directo
ries=0,toolbar=0,scrollBars=auto,resizable=0,statu
s=0,width=800,height=600');
var myTitle = "PurpleTequila.com";
NewWin.document.write('<title>'+myTitle+'</title><embed src="purple.swf">');

}
}
</script>

senn
02-09-2003, 02:01 AM
Originally posted by khalidali63
Interesting

replace the function with this


<script language="JavaScript">
function PurpleTequila() {
NewWin=window.open('','PurpleTequila','location=0,menubar=0,directo
ries=0,toolbar=0,scrollBars=auto,resizable=0,statu
s=0,width=800,height=600');
var myTitle = "PurpleTequila.com";
NewWin.document.write('<title>'+myTitle+'</title><embed src="purple.swf">');
}
</script>


Hi khalidali63,

The above code works by opening a window with title "PurpleTequila.com", but "purple.swf" is embeded as a tiny little flash in a corner of the window.

so i added height and width parameters to make

NewWin.document.write('<title>'+myTitle+'</title><embed src="purple.swf" width="800", height="600", border="0">');

This enlarges the flash to the correct size but the flash movie does not sit snugly in the window. That is to say the flash movie is offset by about width=20 height=20 and the window's background is visible on the top and left sides.

After sifting through the html forum, i found this to great use

<FRAMESET cols = "*">
<FRAME src="purple.swf">

the final script looks like this



<script language="JavaScript">
function PurpleTequila() {
NewWin=window.open('','PurpleTequila','location=0,menubar=0,directo
ries=0,toolbar=0,scrollBars=auto,resizable=0,statu
s=0,width=800,height=600');
var myTitle = "PurpleTequila.com";
NewWin.document.write('<title>'+myTitle+'</title><FRAMESET cols = "*"><FRAME src="purple.swf">');
');
}
</script>


Thanks! and here's how it looks http://www.purpletequila.com