How do we get the name of the present page into a varible?

P

paul

HI! How so get the name of the present page into a variable? I need it
because I need to attach it to a path so I can make others link to me.
My pages are in iframes.

Paul
 
E

Evertjan.

paul wrote on 25 feb 2006 in comp.lang.javascript:
HI! How so get the name of the present page into a variable? I need it
because I need to attach it to a path so I can make others link to me.
My pages are in iframes.

var pathAndPage = location.href
 
M

Manifest Interactive

Greetings,

You can also use the following if you just want the page you are on
WITHOUT the rest of the URL.

<script>
var thisPath = window.location.pathname;
var thisPage = thisPath.substring(thisPath.lastIndexOf('/') + 1); //
current page
</script>

You would just use the vaiable "thisPage" to get the current page you
are on.

Hope this helps,

- Peter Schmalfeldt
Manifest Interactive
 
P

paul

HI! Thanks for the reply, I think though I might need to trim it though. I
see that it give me the whole path and not just page name. so I have to
create a IF statement to check to see if a condition is true then trim out
the part that I don't want. I will have to repost as this is different than
this heading.

Paul
 
E

Evertjan.

paul wrote on 26 feb 2006 in comp.lang.javascript:

[please do not toppost on usenet]
HI! Thanks for the reply, I think though I might need to trim it
though. I see that it give me the whole path and not just page name.
so I have to create a IF statement to check to see if a condition is
true then trim out the part that I don't want. I will have to repost
as this is different than this heading.

var pageOnly = location.href.replace(/.*\//,'')
 
P

paul

HI! What is top top posting? I use Outlook express and to reply I click on
Reply to Group when I am on the last response. and the news group that this
post is posted to is comp.lang.javascript from my sympatico.ca provider.

Paul



Evertjan. said:
paul wrote on 26 feb 2006 in comp.lang.javascript:

[please do not toppost on usenet]
HI! Thanks for the reply, I think though I might need to trim it
though. I see that it give me the whole path and not just page name.
so I have to create a IF statement to check to see if a condition is
true then trim out the part that I don't want. I will have to repost
as this is different than this heading.

var pageOnly = location.href.replace(/.*\//,'')
 
T

Thomas 'PointedEars' Lahn

Ian said:
paul said:
[...] What is top top posting? I use Outlook express and to reply I click
on Reply to Group when I am on the last response. [...]

You've just done it!

Apparently Outlook can be configured to append rather than prepend your
response.

Outlook (Express) has many flaws (including Cc'ing to the newsgroup when
Followup-To: poster was set), but its default quotation setting is correct,
common to many newsreaders, and should not be changed. The text cursor is
placed above the quote so that a reasonable poster can go through the quote
from top to down, snip the parts he/she is not referring to, and include
the reply just below each of the (minimized) parts he/she is referring to.

<URL:http://netmeister.org/news/learn2quote.html>


HTH

F'up2 poster

PointedEars
 
P

paul

HI! I think I know what you are talking about then, right as I send this
post the message is at the top of the page right? What you are saying is
that my message should be below the original message having the previous
message at the top with >>> before each line right?

If so. I must admit that I like it better that the way that I am using it as
I don't have to scroll down to see the reply. However is everyone preferred
the other method ( new reply below ) then I will conform to that. but I
don't see what All the fuss is about. I don't see why an extra step to
scroll down to see one's reply is beneficial!

But if everyone wants it that way then I guess I will look at configuring my
outlook express to do just that.

Paul

Thomas 'PointedEars' Lahn said:
Ian said:
paul said:
[...] What is top top posting? I use Outlook express and to reply I
click
on Reply to Group when I am on the last response. [...]

You've just done it!

Apparently Outlook can be configured to append rather than prepend your
response.

Outlook (Express) has many flaws (including Cc'ing to the newsgroup when
Followup-To: poster was set), but its default quotation setting is
correct,
common to many newsreaders, and should not be changed. The text cursor is
placed above the quote so that a reasonable poster can go through the
quote
from top to down, snip the parts he/she is not referring to, and include
the reply just below each of the (minimized) parts he/she is referring to.

<URL:http://netmeister.org/news/learn2quote.html>


HTH

F'up2 poster

PointedEars
 
P

paul

HI! What is the inverse to the code you gave me ? (Meaning to have only the
path and not the file name).

var pageOnly = location.href.replace(/.*\//,'')

ps. I cant figure out where to change the settings to not top post in my
settings so I posted this question at the outlook express newsgroup and I am
awaiting an answer.

Paul

Evertjan. said:
paul wrote on 26 feb 2006 in comp.lang.javascript:

[please do not toppost on usenet]
HI! Thanks for the reply, I think though I might need to trim it
though. I see that it give me the whole path and not just page name.
so I have to create a IF statement to check to see if a condition is
true then trim out the part that I don't want. I will have to repost
as this is different than this heading.

var pageOnly = location.href.replace(/.*\//,'')
 
T

Thomas 'PointedEars' Lahn

paul said:
HI! I think I know what you are talking about then, right as I send
this post the message is at the top of the page right? [... Top post]

Wrong. Read again. Including the part about Followup-To: poster.


F'up2 poster set again

PointedEars
 
P

paul

Thomas said:
paul said:
HI! I think I know what you are talking about then, right as I send
this post the message is at the top of the page right? [... Top post]

Wrong. Read again. Including the part about Followup-To: poster.


F'up2 poster set again

PointedEars

HI! I have dn a fix for outlook Express 6 that reformats the message in
bottom style posting. It also fixes a few others things as far as formating
goes. Here is the link that I got from an Outlook Express 6 MVP .
http://home.in.tum.de/~jain/software/oe-quotefix/

Paul
 
E

Evertjan.

paul wrote on 28 feb 2006 in comp.lang.javascript:

Same to you.
ps. I cant figure out where to change the settings to not top post in
my settings so I posted this question at the outlook express newsgroup
and I am awaiting an answer.

I am not going to answer your technical question, Paul, as long as you are
responding above the quote, which is called topposting and is independent
of Outlook, since you can write the answer wherever you choose.

Sparce interposting, where you only quote what is essential and nawer oon
the subjects just below that specific quote is the best way, according to
MHO, and many others. This has been the way of usenet for decades.

The only thing you can change in Outlook is the initial position of the
cursor, I [an Outlook hater] suppose.

Communicating [reading and posting] on usenet can much better be done by
one of the dedicated "newsreaders". Most are free, btw.

If you persist in topposting despite the anwers you are given, the number
of anwers will die out.
What is the inverse to the code you gave me ? (Meaning to have
only the path and not the file name).

var pageOnly = location.href.replace(/.*\//,'')

btw, did you try something yourself? Show us.
 
T

Thomas 'PointedEars' Lahn

paul said:
Thomas said:
paul said:
HI! I think I know what you are talking about then, right as I send
this post the message is at the top of the page right? [... Top post]
Wrong. Read again. Including the part about Followup-To: poster.

F'up2 poster set again
^^^^^^^^^^^^
This means: "Please reply only via e-mail (because this is off-topic here)".
[my signature]

HI! I have dn a fix for outlook Express 6 that reformats the message in
bottom style posting. It also fixes a few others things as far as
formating goes. Here is the link that I got from an Outlook Express 6
MVP . http://home.in.tum.de/~jain/software/oe-quotefix/

It would have been better if you powered on your Central Brain Unit
before posting, because that unnecessary "fix" does not suffice at all.
But apparently you are incapable of drawing meaning from the words you
read:

,-[news:[email protected]]
|
| [...] The text cursor is placed above the quote so that a reasonable
| poster can go through the quote from top to down, snip the parts he/she
| is not referring to, and include the reply just below each of the
| (minimized) parts he/she is referring to.


Score adjusted, F'up2 poster

PointedEars
 
P

paul

Thomas said:
paul said:
Thomas said:
paul wrote:
HI! I think I know what you are talking about then, right as I send
this post the message is at the top of the page right? [... Top post]
Wrong. Read again. Including the part about Followup-To: poster.

F'up2 poster set again
^^^^^^^^^^^^
This means: "Please reply only via e-mail (because this is off-topic
here)".
[my signature]

HI! I have dn a fix for outlook Express 6 that reformats the message in
bottom style posting. It also fixes a few others things as far as
formating goes. Here is the link that I got from an Outlook Express 6
MVP . http://home.in.tum.de/~jain/software/oe-quotefix/

It would have been better if you powered on your Central Brain Unit
before posting, because that unnecessary "fix" does not suffice at all.
But apparently you are incapable of drawing meaning from the words you
read:

,-[news:[email protected]]
[...] The text cursor is placed above the quote so that a reasonable
poster can go through the quote from top to down, snip the parts he/she
is not referring to, and include the reply just below each of the
(minimized) parts he/she is referring to.


Score adjusted, F'up2 poster

PointedEar


HI! You are arogant, rude, and obnoxoux, And I am not going to give you any
power.,, so you are now BLOCKED. so dont bother repling.

Thank you.

Paul
 
P

paul

Evertjan. said:
paul wrote on 28 feb 2006 in comp.lang.javascript:

Same to you.
ps. I cant figure out where to change the settings to not top post in
my settings so I posted this question at the outlook express newsgroup
and I am awaiting an answer.

I am not going to answer your technical question, Paul, as long as you are
responding above the quote, which is called topposting and is independent
of Outlook, since you can write the answer wherever you choose.

Sparce interposting, where you only quote what is essential and nawer oon
the subjects just below that specific quote is the best way, according to
MHO, and many others. This has been the way of usenet for decades.

The only thing you can change in Outlook is the initial position of the
cursor, I [an Outlook hater] suppose.

Communicating [reading and posting] on usenet can much better be done by
one of the dedicated "newsreaders". Most are free, btw.

If you persist in topposting despite the anwers you are given, the number
of anwers will die out.
What is the inverse to the code you gave me ? (Meaning to have
only the path and not the file name).

var pageOnly = location.href.replace(/.*\//,'')

btw, did you try something yourself? Show us.

HI! I tried using the slice command and it worked too. but now I see that I
will be able to use a simpler method to achieve what I want.

Issue: My site that I am working on uses Iframes and I used some serverside
vb scripting to retrieve the info and display the page in the iframe. which
is good because now If someone wants to link to an article my partner wrote
all I have to do is attach the main file path and the child path. "ifp" is
the varible name.

eg. http://www.mywebsite/folder/main.asp?ifp=childpath/iframepage

So to make things simpler ( but a bit fat though) is too add a link/button
in the iframe page so that users who want to know the link so that they can
link to that page can press that button and a popup with the link inside
would be displayed.

Attaching the link:

<script type="text/javascript">
var ifplink = location.href.replace;
var ifplink = ('http://www.mywebsite/folder/main.asp?ifp=' + ifplink );
</script>

Retrieving the link:

<!-- Begin of Set Default for Iframe -->
<%
dim ifp
ifp = Request.QueryString("ifp")
if ifp <> "" then
%>
<iframe src=<%= ifp %> id="Iframemain" name="Iframename" height="475"
width="508" scrolling="no" frameborder="0" marginwidth="0" marginheight="0"
onLoad="autoResize('Iframename');">My message to user</iframe>

<% else %>

<iframe src="pathtofile/defaultfile.asp" id="Iframename" name="Iframemain"
height="475" width="508" scrolling="no" frameborder="0" marginwidth="0"
marginheight="0" onLoad="autoResize('Iframename');">My message to
user</iframe>
<% end if %>
<!-- End of Set Default for Iframe -->

So far all is well. but I have not tested it with the popup window yet.

As far as the post is concerned is this post ok? I choose this option in the
OE Fix but there is another option but I was not sure about it until now as
you mentioned it "Sparce interposting". But the method I choose so far does
resemble the way others have been posting so I am assuming this is ok.

Paul
 
E

Evertjan.

paul wrote on 01 mrt 2006 in comp.lang.javascript:
[...]
HI! I tried using the slice command and it worked too.
but now I see that I
will be able to use a simpler method to achieve what I want.

Regex replace() is very powerfull and looks fine in javascript
Attaching the link:

<script type="text/javascript">
var ifplink = location.href.replace;

This seems nonsense to me.
location.href.replace, what is that?
I know location.replace, but that does not return a value.

Or do you mean our earlier Regex replace()??

var ifplink = location.href.replace(/.../.,'....'); ?

why the ()?

This will do fine:

var ifplink = 'http://www.mywebsite/folder/main.asp?ifp=' + ifplink;

or even better if you expect speces in ifplink:

var ifplink='http://www.mywebsite/folder/main.asp?ifp='+ escape(ifplink);

</script>
Retrieving the link:

<!-- Begin of Set Default for Iframe -->
<%
dim ifp
ifp = Request.QueryString("ifp")
if ifp <> "" then
%>
<iframe src=<%= ifp %> id="Iframemain" name="Iframename" height="475"
width="508" scrolling="no" frameborder="0" marginwidth="0"
marginheight="0" onLoad="autoResize('Iframename');">My message to
user</iframe>

height="475"

Try using css: <iframe style='height:475px;..etc..' ...

<% else %>

<iframe src="pathtofile/defaultfile.asp" id="Iframename"
name="Iframemain" height="475" width="508" scrolling="no"
frameborder="0" marginwidth="0" marginheight="0"
onLoad="autoResize('Iframename');">My message to user</iframe>
<% end if %>
<!-- End of Set Default for Iframe -->

why not simply:

======================
<%
dim ifp
ifp = Request.QueryString("ifp")
if ifp = "" then ifp = "pathtofile/defaultfile.asp"
%>
<iframe src='<%= ifp %>' id="Iframemain" name="Iframename" height="475"
width="508" scrolling="no" frameborder="0" marginwidth="0"
marginheight="0" onLoad="autoResize('Iframename');"></iframe>
=============

src='<%= ifp %>'

use quotes here, because if you get a url with spaces, you would be in
error. [I prefer single quotes/apostrophes for clientside html and
javascript, vbcript needing double quotes of course]
So far all is well. but I have not tested it with the popup window
yet.

As far as the post is concerned is this post ok?

Yes !!!
 
P

paul

Evertjan. said:
paul wrote on 01 mrt 2006 in comp.lang.javascript:
[...]
HI! I tried using the slice command and it worked too.
but now I see that I
will be able to use a simpler method to achieve what I want.

Regex replace() is very powerfull and looks fine in javascript
Attaching the link:

<script type="text/javascript">
var ifplink = location.href.replace;

This seems nonsense to me.
location.href.replace, what is that?
I know location.replace, but that does not return a value.

Or do you mean our earlier Regex replace()??

opps I meant var ifplink = location.href;
All I needed was to put the URL into a variable.

var ifplink = location.href.replace(/.../.,'....'); ?


why the ()?

This will do fine:

var ifplink = 'http://www.mywebsite/folder/main.asp?ifp=' + ifplink;

or even better if you expect speces in ifplink:

var ifplink='http://www.mywebsite/folder/main.asp?ifp='+ escape(ifplink);

Hmm. I though I needed the () when adding strings together.
<iframe>This content has no meaning!!!Leave it out</iframe>

I dont understand what you are telling me to leave out. Do you mean the
message to the user if the browser does not support iframes or is it the
whole block as to your modification you suggested I take below.
Try using css: <iframe style='height:475px;..etc..' ...

Yes I should use the style tag instead.

why not simply:

======================
<%
dim ifp
ifp = Request.QueryString("ifp")
if ifp = "" then ifp = "pathtofile/defaultfile.asp"
%>
<iframe src='<%= ifp %>' id="Iframemain" name="Iframename" height="475"
width="508" scrolling="no" frameborder="0" marginwidth="0"
marginheight="0" onLoad="autoResize('Iframename');"></iframe>
=============

Yes I agree, defently more efficiant.
src='<%= ifp %>'

use quotes here, because if you get a url with spaces, you would be in
error. [I prefer single quotes/apostrophes for clientside html and
javascript, vbcript needing double quotes of course]

I did not know about, thanks.

Thanks allot for all the pointers and advise you have given me, I really
appreciate it :)

Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,796
Messages
2,569,645
Members
45,371
Latest member
TroyHursey

Latest Threads

Top