open popup in new window


Hi, I am using following code to make table and with linmks,and when the link is clicked,file is opened.But now i want file to be opened in a new window.var tblBodyObj = window.opener.document.getElementById("maintable").tBodies[0];
var newCell=tblBodyObj.rows[0].insertCell(-1);
var doc = window.opener.document;
var link = doc.createElement('a');
link.href = '../UploadedFilesByUser/'+fname[j]+'';var img= doc.createElement('img');
ext[j]= fname[j].slice(-3)
img.setAttribute("src",'../images/'+ext[j]+'.PNG');
newCell.appendChild(img);
link.appendChild(doc.createTextNode(fname[j]));
newCell.appendChild(link);
j++;
Please help.
thanks
Prachi
0
prachikaushik07
5/5/2009 3:56:39 AM
📁 asp.net.web-forms
📃 93655 articles.
⭐ 6 followers.

💬 3 Replies
👁️‍🗨️ 4325 Views



link.setAttribute("target","_blank")
 

Plz remember to click "Mark as Answer" if this helped you.
1
Ugly
5/5/2009 4:20:33 AM

Add the Target property and that will open it in a new window:
img.setAttribute("target",'_blank');
Other options are:
_blank - will open a new browser window with no name.
_self - will replace the current html page, so if it is in a frame or frameset it will load within that frame. If it is the full browser, it will open to replace the page in the full browser.
_parent - will replace the html page it came from.
_top - will load in the current browser by replacing anything within the browser such as a frameset

Sincerely,
Malcolm Sheridan
Microsoft Certified Solution Developer
Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as
Answer" if a marked post does not actually answer your question.
1
malcolms
5/5/2009 5:04:07 AM

 Try with this:
img.setAttribute("../images/'+ext[j]+'.PNG","_blank");

Ahsan Murshed
__________________________
Please "Mark as Answered" if helpful for you.
ASP BOSS
0
ahsanm
5/5/2009 5:23:28 AM
Reply: