471,854 Members | 1,497 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,854 software developers and data experts.

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>
Thanks and regards in advance.
Sep 16 '07 #1
2 2212
5,821 Expert 4TB
Heya, dhaneshrs. Welcome (back) to TSDN!

Please use CODE tags when posting source code:

JavaScript code goes here.
Sep 16 '07 #2
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'); 
  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 NeoPa | last post: by
reply views Thread by aboka | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.