danieleizik Posted January 5, 2012 Share Posted January 5, 2012 Hi.I want to add to my website's text editor, htmlarea, the "target="blank"" command on its links generator.As for now, When I mark something as a link and I press it, the link opens in the same window so I have to leave my site.I want it to open in a new window, and I understood that I'll have to add the targat command.This is the code of the "browselink.asp" file in the editors folder (I believe this is the part that controlls the links generator: <%@ Language=VBScript %><% Option Explicit %><html><head><title>Browse For Links</title></head><body bgcolor="white"><!--#include file="dirwalk.asp" --><%''''''''''''''''''''''''''''''''''''''''''''''''''''''' S Babu. vsbabu@hotmail.com.' http://vsbabu.csoft.net'''''''''''''''''''''''''''''''''''''''''''''''''''''''''Prints a link for copying the path to some form fieldSub PrintCopyLink(strPath, strName) 'URLs are different from DOS directory seps strPath = "/" & Replace(CutRootFolder(strPath), "\", "/") Response.Write "<a href=""#"" onClick=""top.document.forms[0].elements['LinkUrl'].value='" & strPath & "'"" >" & strName & "</a>"End SubMainProcess%></body></html> I couldnt understand where I need to add this command and how.Thanks, Daniel. Link to comment Share on other sites More sharing options...
justsomeguy Posted January 5, 2012 Share Posted January 5, 2012 That link doesn't open the URL, it just sets the value of some form field with the URL. It doesn't actually open it. Link to comment Share on other sites More sharing options...
danieleizik Posted January 6, 2012 Author Share Posted January 6, 2012 ok but isnt this code responsible of the full "a href" code structure? so if I want to add the target code to the links template shouldnt I add it there? so in every article I publish on my website, links will automaticlly open on a new tab? Link to comment Share on other sites More sharing options...
justsomeguy Posted January 6, 2012 Share Posted January 6, 2012 ok but isnt this code responsible of the full "a href" code structure?Not from what I see. It writes out an <a> tag, but clicking on it only sets the value of a form element, it doesn't open the URL. The link that opens the URL is somewhere else. The name of that function is "PrintCopyLink", so it sounds like it's a way for the user to copy the URL. Just look at the link, the href is set to "#", which doesn't do anything, and the onclick event changes the value of a field in a form. The field name is "LinkUrl". Link to comment Share on other sites More sharing options...
danieleizik Posted January 7, 2012 Author Share Posted January 7, 2012 ok..so I found another document which I could find the word "href" in it without this #.Thats its code: <%@ language=vbscript %><%Set conntemp = server.CreateObject("adodb.Connection")'conntemp.open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath ("../../../../../data/template1.mdb")'conntemp.open "DSN=template1"conntemp.Open "Driver={SQL Server};Server=mssql.zenithtech.com;Database=web4uT;UID=web4u;PWD=tonydinanoa"Buffer = TrueResponse.expiresAbsolute = Now() - 10Response.expires = 0Response.addHeader "pragma", "no - cache"Response.addHeader "cache-control", "private"'------check for pack iddim sql,packsql="select url from accounts where accountID="&session("pID")set rs=conntemp.execute(sql)pack=trim(rs("url"))rs.closeset rs=nothingsql="select innerPageID,innerPageTitle,cat_id from innerPageDetails where accountID="&session("pID")&" order by cat_id,innerPageOrder"set rs5=conntemp.execute(sql)%><HTML><HEAD><meta http-equiv="Content-Type" content="text/html; charset=windows-1255"><link rel="stylesheet" type="text/css" href="style1.css"><script LANGUAGE="JavaScript"><!--function selectPage(pageID,catID){packagesLocation="http://www.web4u.co.il/t/"opener = window.dialogArguments;var _editor_url = opener._editor_url;var objname = location.search.substring(1,location.search.length);fileValue="index.asp?innerPageID="+pageID+"&cat_id="+catID//opener.editor_insertHTML(objname, "<a href="+_editor_url+"../../"+fileValue+">","</a>", 1)opener.editor_insertHTML(objname, "<a class=text href="+packagesLocation+"<%=pack%>/"+fileValue+">","</a>", 1)window.close(); // close dialog}function regularLink(linki){opener = window.dialogArguments;var _editor_url = opener._editor_url;var objname = location.search.substring(1,location.search.length);fileValue=linkiif(linki=="" || linki=="http://www."){alert("write a link")}else{//alert(_editor_url+fileValue)opener.editor_insertHTML(objname, "<a href="+fileValue+" target="_blank">","</a>", 1)window.close(); }// close dialog}function mailLink(linki){opener = window.dialogArguments;var _editor_url = opener._editor_url;var objname = location.search.substring(1,location.search.length);fileValue=linkiif(linki=="" || linki=="mailto:"){alert("write a link")}else{opener.editor_insertHTML(objname, "<a href="+fileValue+">","</a>", 1)window.close(); }// close dialog}//--></SCRIPT><TITLE> New Document </TITLE></HEAD><BODY dir=rtl><h2>link to external site:</h2><FORM METHOD=POST name=formi ACTION=""><input name=linki size=50 dir=ltr value="http://www."><input type=button value="link" onclick="regularLink(document.formi.linki.value)"><input type=button value="check link" onclick="window.open(document.formi.linki.value,'','status=no,width=400,height=200')"></FORM><h2>link to email:</h2><FORM METHOD=POST name=formi2 ACTION=""><input name=linki2 size=50 dir=ltr value="mailto:"><input type=button value="link" onclick="mailLink(document.formi2.linki2.value)"><input type=button value="check link" onclick="location.href=document.formi2.linki2.value"></FORM><h2>link to internal page</h2>choose a page name which you want to link the word<BR><table><ul><%do while not rs5.eof%><tr><td><li><input type=button onclick="selectPage('<%=rs5("innerPageID")%>','<%=rs5("cat_id")%>')" value="<%=rs5("innerPageTitle")%>"> </td><td><A HREF="../../../code/index.asp?innerPageID=<%=rs5("innerPageID")%>" target="_blank">(PREVIEW)</A></td></tr><%rs5.movenextloop%><tr><td><li><input type=button onclick="mailLink('http://www.web4u.co.il/web4u/code/contact.asp')" value="contact"> </td><td><A HREF="../../../code/contact.asp%>" target="_blank">(PREVIEW)</A></td></tr></table><%rs5.closeset rs5=nothing%></ul></BODY></HTML><%conntemp.CloseSet conntemp = Nothing%> but I cant find a place with a link without this target="_blank".. Link to comment Share on other sites More sharing options...
justsomeguy Posted January 9, 2012 Share Posted January 9, 2012 In this line you need to escape the quotes around _blank: opener.editor_insertHTML(objname, "<a href="+fileValue+" target="_blank">","</a>", 1) Link to comment Share on other sites More sharing options...
danieleizik Posted January 12, 2012 Author Share Posted January 12, 2012 thanks but its still not working Link to comment Share on other sites More sharing options...
justsomeguy Posted January 12, 2012 Share Posted January 12, 2012 I'm not sure what to tell you. You need to go through the code to figure out exactly what happens when you insert the link or save the text. If there's a button you click on to enter the URL and then it runs a Javascript function to update the text, then you need to figure out which function it is running and change that function. If that regularLink function isn't the one that adds links then you need to figure out which one does. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.