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

Can you retrieve a page title and assign it to a variable?

Status
Not open for further replies.

MahendraMahey

Programmer
May 13, 2003
13
GB
This is following on from a previous thread.

Is it possible to assign the page title to a variable?
 
I suppose you could set a variable and then use it in your page title. Something like this, perhaps:

<%
dim title
sampleTitle = &quot;This is the page title&quot;
%>
<title><%=sampleTitle%></title>

Everything is absolute. Everything else is relative.
 
Is it possible to assign the page title to a variable?

NO!!

ASP has no interaction with the code (HTML). This portion of a page is interpruted by the browser, NOT the server.

The answer in the vbsctip forum was document.title returns the value.
dim str
str = document.title
client side coding

what are you trying to do with this value. Is this ASP or vbscript you are scripting?

if you need to the server to know add the value to a form and submit the page or redirect it so the server is called again.

_________________________________________________________
$str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
$Nstr = ereg_replace(&quot;sleep&quot;,&quot;coffee&quot;,$str); echo $Nstr;

onpnt2.gif
[/sub]
 
I have tried doing this but it doesn't work, may be I am doing something wrong. I am using Vbscript by the way and thank you for your response on the other forum.

Could you give us an example with code that works.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top