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

"Calling" Javascript

Status
Not open for further replies.

arundahar

Programmer
Apr 27, 2001
53
GB
Hi, how do i run a piece of Javascript from within ASP.
I don't want the user to click on anything, i just want the page to load and the javascript to run (it's to change the <TITLE> of the page) or if you can change the Title through ASP that would be even better!! I can't put it in the <body> and call the OnLoad or whatever as i need loads of ASP processed first...

Thanks in advance..

A
 
arundahar:

I think all you need to do is to put your javascript between <script></script> tags wherever you need it - the server will send it on to the client's browser and it will be executed there...

DrMaggie

PS As I just wrote in another thread: I don't think you can change the title string dynamically with VBScript (what you call ASP??) - you have to force a page reload.
---------
&quot;Those who don't know the mistakes of the past won't be able to enjoy it when they make them again in the future.&quot;
— Leonard McCoy, MD (in Diane Duane's Doctor's Orders)
 
You said that if the TITLE could be changed in ASP, that would be better. So why can't you try:


<%
Dim titlename

titlename=&quot;What ever you want &quot; & username & Now()
%>

<HTML>
<HEAD>
<TITLE><%=titlename%></TITLE>
...


Which will define a variable (titlename) and then set it to the current time or the name of the user, or some other text. And then that variable is used in the <TITLE> of the document.

Is this what you were wanting?
Einstein47
(Love is like PI - natural, irrational, endless, and very important.)
 
err no, this same page just reloads every time displaying different products. As the processing is further down the page this code isn't very helpful..
 
arundahar:

Why must the e-mail processing be done &quot;further down the page&quot; ?? Why not move that stuff up - or does it require some JavaScript form handling, or similar, to work?

DrMaggie
---------
&quot;Those who don't know the mistakes of the past won't be able to enjoy it when they make them again in the future.&quot;
— Leonard McCoy, MD (in Diane Duane's Doctor's Orders)
 
email processing?? what are you talking about?
the processing down the page displays products on the page, and no this can't be moved up as it's a complex page which has all sorts of validation going on. I want the Javascript to run WITHOUT any user interaction, the best i've heard so far is the window.onfocus option, but this happens when the page is reloaded so still to early...
 
Hi,

Try this:

(asp code....)
%>
<script language=JScript>
document.title='<%= strTitle %>'
</script>
<%
(more asp code....)

where strTitle is the title you want to use, defined somewhere further up in your code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top