PDA

View Full Version : JavaScript Code Problem


Tricky
01-09-2003, 17:13
Help, I'm writing a photoalbum in JAVA and need some help...

I want to change the title of the browser window (the remote one) to something more meaningful (like my webspace name)

The code which creates a new window with the image in is:
imgName="photos/st_"+aImage[iImagenum]
imgWindow=window.open(imgName,"imgWin","Width=660,height=510,scrollbars=no,status=yes")
imgWindow.window.status=aText[iImagenum]

I can change the "Status Bar" of the window as in the 3rd line of code above, but I want to change/set the title (Ie. nthellworld.co.uk at the top left of your browser).

Any ideas?:confused:

Tricky
01-09-2003, 17:59
Best I could manage but it works!:eek: :eek:

imgName="photos/st_"+aImage[iImagenum]
imgWindow=window.open('','imgWin','height=510,widt h=660,scrollbars=no,status=yes');
imgWindow.document.write('<HTML><HEAD><TITLE>Your Selected Image: '+aImage[iImagenum]+'</TITLE>');
imgWindow.document.write('<LINK REL="stylesheet" HREF="../../../rtstyle_zeddy.css">');
imgWindow.document.write('</HEAD>');
imgWindow.document.write('<BODY>');
imgWindow.document.write("<IMG SRC="+imgName+" </IMG>");
imgWindow.document.write('</BODY></HTML>');
imgWindow.window.status=aText[iImagenum]

philip.j.fry
01-09-2003, 18:08
Originally posted by Tricky
Help, I'm writing a photoalbum in JAVA and need some help...



Don't you mean Javascript :)

Alan Waddington
01-09-2003, 20:48
<html>
<head><title>Extreme PhotoAlbum</title></head>
<body>
<script language="javascript">
imgWindow=window.open("image0013.jpg","imgWin","Width=660,height=510,scrollbars=no,status

=yes");
imgWindow.document.title="Really interesting picture";
</script>
</body>
</html>


/edit works in IE6, doesn't in Mozilla 1.4 or Nescape 4

Guess it depends whether that's important

Tricky
01-09-2003, 22:14
Cheers mate, I was certain that I'd tried the obvious but alas I can't have done - I've stuck with my dodgy code because I've duplicated it in a number of html pages now!!!

Thanks again...:D

Bifta
01-09-2003, 23:27
could you not just use document.title ?

edit: should maybe read whole thread before replying :spin:

MadGamer
07-09-2003, 10:11
Maybe you should select everthing before you start to copy over to another location

Tricky
07-09-2003, 11:18
Originally posted by WNA
Maybe you should select everthing before you start to copy over to another location

And translated means?:confused:

Richard M
07-09-2003, 12:59
You shouldn't be using IE only JS, try learning the proper way with the DOM:
http://www.w3.org/DOM/

MadGamer
07-09-2003, 14:26
Umm err no notepad to be precise:mad: :mad: :mad: