Re: Potential solution for Insert Link (ASP version 3.0)

  •  07-05-2005, 4:27 PM

    Re: Potential solution for Insert Link (ASP version 3.0)

    Adam,
    I'm not sure where the 'Insert Code' button is. Hmmmm! So I used a textarea box.

    To start with I'm no javascript guy!

    Currently I am not using the 'Type' (https, ftp, gopher, news, etc) stuff. Only the http: is needed for my purpose. I'm sure it could be worked on a bit more to consider these other types. The problem I found with the original code was with the javascript command 'pasteHTML(HTML)'. This is found in the WinIE.js file. If the command pasteHTML(HTML) sees the HTML variable as a link (the string contains the href that sets this baby off), it will default to the absolute path and the browser will insert the 'http://www.domain.com/yourfile.asp automatically. THIS COMMAND WILL NOT DO RELATIVE LINKS! Don't know how to get around it. Did alot of research but didn't find much info on this command that would possibly allow me to insert a relative link. Found out by trial and error that if I typed '//http://www.domain.com' in the URL textbox of the insert_link.asp  file (notice the '//' at the begining of the URL) that it would remove the domain name and insert only 'http' + any text after that. So to me the // was key. I then wrote code that would test for the 'http' in the imgname.value variable. If it was not present an alert("You must use a complete URL - http://www.domain-name.com") would prompt the user to use absolute links. In other words the user MUST USE THE COMPLETE URL and type the whole thing in.

    Basically, if you can't beat it, play the game it wants to play. I hope I explained it well enough for you Adam. Thanks again for a great product.

    bvo

View Complete Thread