Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Popup Window Title 1

Status
Not open for further replies.

Davefeet

Technical User
Jan 24, 2002
212
US
In my pop up windows the title (on the very top) is given as the full file name of the referenced image. I want to edit that and instead have it give some kind of description of the image.

<SCRIPT>
function openwindow(open){
window.open(open,&quot;Popup&quot;,&quot;toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0, width=350, height=250, top=0, left=0&quot;)
}
</SCRIPT>



<a href=&quot;javascript:eek:penwindow('Potential%20Graphics/EXCEL%20QUICK%20MATH%20ANswer.jpg')&quot;>&quot;NUM&quot;</a> Salt Lake City Home of 2002 Winter Olympics
 
Try this:

<SCRIPT>
function openwindow(open, imtitle){
var newwin = window.open(open,&quot;Popup&quot;,&quot;toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0, width=350, height=250, top=0, left=0&quot;);

newwin.title = imtitle;
}
</SCRIPT>
 
Little mistake in the last line of the script, it should be:

newwin.document.title = imtitle;
 
That shouldnt work, at least not online!
I tried it for a frameset and it didnt work with
parent.title but that is caused by my server.

I hope this helps, BobbaFet

Everyone has a right to my opinion.
E-mail me at caswegkamp@hotmail.com

&quot;<beer brand> is like making love in a cano...
it's <f-word + ing> close to water !!!&quot;
- Monty Python's Flying Circus, 1969/70
 
that could be caused i meant BobbaFet

Everyone has a right to my opinion.
E-mail me at caswegkamp@hotmail.com

&quot;<beer brand> is like making love in a cano...
it's <f-word + ing> close to water !!!&quot;
- Monty Python's Flying Circus, 1969/70
 
Anybody got any other suggestions
Salt Lake City Home of 2002 Winter Olympics
 
OK, the solution maybe slightly &quot;longer&quot; than you expected, but it's a right way of doing this.

function openwindow(image, winTitle) {

newwin=window.open(&quot;&quot;,&quot;&quot;,&quot;toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0, width=350, height=250, top=0, left=0&quot;);
newwin.document.open();
newwin.document.write('<html><body>');
newwin.document.write('<title>', winTitle, '</title>');
newwin.document.write(image);
newwin.document.write('</body></html>');
newwin.document.close();
}


<a href=&quot;javascript:eek:penwindow('Potential%20Graphics/ EXCEL%20QUICK%20MATH%20ANswer.jpg', 'Page Title')&quot;>&quot;NUM&quot;</a>

This works in IE and Netscape 4/6.
Try to use always the complete code for pop-up windows and you'll avoid many troubles.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top