PDA

View Full Version : Converting URL


Jon T
05-19-2003, 09:05 PM
Having some problems converting the URL over in that anything after the Questionmark gets dropped. (?)

Here is a javaScript I wrote, to convert the URL and page title over to a single "Tell a Friend" Link, but its not coming out right...

What should be:

http://www.domain.com/directory/page.asp?var=Value

Turns to

http://www.domain.com/directory/page.asp

I do not know enough about the ASP Dom to figure this out. Been banging my head on the desk all day. Here is the javascript, anyone know a good conversion?


<script language="JavaScript">
<!-- Hide Me
var urlr = window.document.location.toString();
var doct = window.document.title.toString();

document.write('<a class="sbwblink-b" href="mailto:?body=bla msg- ' + urlr + '&subject=' + doct + '" class="ctrail" title="Tell a Friend">Tell a Friend&nbsp;››<\/a>');
// Show Me -->
</script>

Thank you!

Mhtml
05-20-2003, 03:41 PM
Ok, now either ASP has turned into a serverside language and is aliasing as JavaScript since I turned to PHP or people are getting confused with JavaScript and ASP. ??? :confused: :mad: :rolleyes:

Jon T
05-20-2003, 09:48 PM
Looking for a conversion of the JavaScript in ASP.

As I had said...

"Here is the javascript, anyone know a good conversion?"


Mhtml Wrote:
Ok, now either ASP has turned into a serverside language and is aliasing as JavaScript since I turned to PHP or people are getting confused with JavaScript and ASP. ???

Maybe people should take a little more time to read the post before they comment.

"Heres Your Sign"

:thumbsup:

raf
05-20-2003, 10:06 PM
Lets make code, not war.

What exactly are you after? I suppose you have an asp-page, and you want it to display a link, with the url like http://www.domain.com/directory/page.asp?var=Value as href?

soemthing like
response.write("<a href=""http://www.domain.com/directory/page.asp?var=Value"">Here!!!!</a>")

Jon T
05-20-2003, 11:52 PM
The JavaScript I have pulls the Document location and the Document Title, then builds a mailto string so a visitor can click on it, and email the link to a friend.

So all I need to know is one of two things. Either convert the JavaScript to ASP or help tell me what the object is for Document Location and Document Title or point me to a place to learn.

That's it really, nothing more, nothing less.

Here is the JS again.

<script language="JavaScript">
<!-- Hide Me
var urlr = window.document.location.toString();
var doct = window.document.title.toString();

document.write('<a class="sbwblink-b" href="mailto:?body=bla msg- ' + urlr + '&subject=' + doct + '" class="ctrail" title="Tell a Friend">Tell a Friend ››<\/a>');
// Show Me -->
</script>

Thank you

Jon T
05-21-2003, 02:32 PM
the answer for asp is URLEncode, the answer for javascript is.

var urlr = escape(window.document.location.toString());


I posted the same question to the MM forum, got the answer on the first response...