469,332 Members | 5,428 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,332 developers. It's quick & easy.

Give window title name

I was making an application in asp .net mostly with help from the asp.net forums and i am using javascript to open a popup in my gridview. I wanted to open a window with the title "MAIN TEST" how do i set the value of the title name ? i am guessing this is the syntax : window.name="main test"; but it doesnt seem to work, here is the script, any help would be appreciated.
Expand|Select|Wrap|Line Numbers
  1. <script language="JavaScript">
  2.  function openNewWindow(URL)
  3.  {
  4.   day = new Date();
  5.   id = day.getTime();
  6.   window.name="main test";
  7.   eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=no,scrollbars=no,location=no,statusbar=no,menubar=no,resizable=yes,width=500,height=600');");
  8.  }
  9. </script>
  10.  
Thanks and regards in advance.
Sep 16 '07 #1
2 2175
pbmods
5,821 Expert 4TB
Heya, dhaneshrs. Welcome (back) to TSDN!

Please use CODE tags when posting source code:

[CODE=javascript]
JavaScript code goes here.
[/CODE]
Sep 16 '07 #2
gits
5,390 Expert Mod 4TB
hi ...

don't use eval in your code ... except you have to eval things like json-data ... there is no need for eval besides that ... have a look at the following example that you may use for your problem:

Expand|Select|Wrap|Line Numbers
  1. window['page' + id] = window.open(URL, '" + id + "', 'toolbar=no,scrollbars=no,location=no,statusbar=no  ,menubar=no,resizable=yes,width=500,height=600'); 
  2.  
  3. window['page' + id].document.title = 'test';
kind regards

ps: and you may drop the window.name statement ... this simply creates a member variable 'name' for window, that is not used the way you want ...
Sep 16 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Phillip Parr | last post: by
3 posts views Thread by NeverLift | last post: by
3 posts views Thread by John Bokma | last post: by
4 posts views Thread by Peter Kirk | last post: by
4 posts views Thread by Daniel Morrissey | last post: by
5 posts views Thread by Tom Gur | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by haryvincent176 | last post: by
reply views Thread by Marylou17 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.