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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need help in coding window open 1

Status
Not open for further replies.

EdRev

Programmer
Aug 29, 2000
510
US
I am trying to create a collapsible treeview based on a filesystem:

I have this link:

<img src="bullet.gif"><a href="<%=fl11.path%>" style="color:darkgreen;"><%=fl11.name%></a>

When the link is clicked, the document (can be .xls, .pdf, .doc, .vbs or .txt) sometimes open on the browser and sometimes open up another window.
I guess it all depends on the users file type setting in the folder option.

What I want to do is to open a new window, regardless.
How can I code an onclick function into this and pass the complete path of the file to the function, something like this:


<img src="bullet.gif"><a onclick="mywind(<%=fl11.path%>)" style="color:darkgreen;"><%=fl11.name%></a>

How can I code mywind function?

Also, I do not want users to make changes on the document.

Any help will be greatly appreciated.
 
Use target="_blank" to open new window.

<a href="<%=fl11.path%>" target="_blank" style="color:darkgreen;"><img src="bullet.gif"><%=fl11.name%></a>
 
or if you are following current w3c guidlines use
Code:
<img src="bullet.gif"><a href="javascript:void(0);"  onclick="mywind('[URL unfurl="true"]http://www.yahoo.com')"[/URL]  style="color:darkgreen;">test</a>
<script>
function mywind(theURL) {
window.open(theURL, '', 'fullscreen=yes, scrollbars=auto');
}
</script>
even better check this site
it has some info about not using target="_blank"

}...the bane of my life!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top