473,399 Members | 3,106 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

ASP within javascript

How can I pull this ASP var into javascript?
What is wrong with this statement?

<%
todaysdate = (now)
response.write (todaysdate)
%>
<script language="JavaScript"><!--
var date = new Date();
var aspdate = <%=todaysdate %>
document.write(aspdate);
//--></script>

Jul 23 '05 #1
4 2539
Targa wrote on 14 jun 2004 in comp.lang.javascript:
How can I pull this ASP var into javascript?
You mix up your terminology!

Javascript does not mean clientside, as ASP can also use j(ava)script.

ASP does not mean VBscript per se, see above,
[and VBscript can also be used clientside in IE]
What is wrong with this statement?

<%
todaysdate = (now)
response.write (todaysdate)
ASP vbs:

todaysdate = now
response.write todaysdate

ASP jscript:

todaysdate = new Date();
Response.write(todaysdate);

%>
<script language="JavaScript"><!--
<script type="text/JavaScript">
var date = new Date();
not used
var aspdate = <%=todaysdate %>
document.write(aspdate);
Is just a string, no javascript date, you write
//--></script>
</script>


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 23 '05 #2
Evertjan. wrote on 14 jun 2004 in comp.lang.javascript:
var aspdate = <%=todaysdate %>


todaysdate has spaces, so:

var aspdate = "<%=todaysdate %>"

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 23 '05 #3
Not much, maybe you should add ; at the end of

var aspdate = <%=todaysdate %>

though that shouldn't be the problem. Have you looked at the document
source to see if the value is really written to the document?
Besides that it looks fine to me.

Targa wrote:
How can I pull this ASP var into javascript?
What is wrong with this statement?

<%
todaysdate = (now)
response.write (todaysdate)
%>
<script language="JavaScript"><!--
var date = new Date();
var aspdate = <%=todaysdate %>
document.write(aspdate);
//--></script>


Jul 23 '05 #4
Vincent van Beveren wrote on 14 jun 2004 in comp.lang.javascript:
Not much, maybe you should add ; at the end of

var aspdate = <%=todaysdate %>


This does not work if todaysdate has whitespace between words.
var aspdate = "<%=todaysdate %>"
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Mike Daniel | last post by:
I am attempting to use document.write(pageVar) that displays a new html page within a pop-up window and the popup is failing. Also note that pageVar is a complete HTML page containing other java...
7
by: David Hayes | last post by:
I tried finding an answer on http://www.quirksmode.org/ without success. I am attempting a complicated Frames structure. I have made it work in IE, but not Netscape. I begin with three...
4
by: Martin Feuersteiner | last post by:
Dear Group I'm using VB to write an aspnet application. I would like to call a javascript function from within a VB Sub or VB Function, is it possible? My code is something like this: VB...
17
by: CES | last post by:
All, I was wondering if their is a way of loading an external script fill from within a script?? <script language="javascript" type="text/javascript"> function test(var){ <script...
13
by: ukrbend | last post by:
I'm new to Javascript and to html and am trying to make the following code snippet work but it doesn't. It refuses to call the getPage() function and I always get a 404 error. I know the code is...
2
by: Jon | last post by:
All, I'm currently working with a PHP-based CMS application, and am begining to put the finishing touches on it via Javascript validation. Currently, I'm using fairly standard methods of...
3
by: Water Cooler v2 | last post by:
Questions: 1. Can there be more than a single script block in a given HEAD tag? 2. Can there be more than a single script block in a given BODY tag? To test, I tried the following code. None...
9
by: misdst23 | last post by:
Hi, I know I can call a static java method within javascript by using the <% ... %tags. But how can pass a javascript variable ? function thefunction() { var = javascriptvariable ;
3
by: u0107 | last post by:
Hello, I have a multi-frame page. The frames are named Frame_1, Frame_2 and Frame_3. Frame_1 has a drop down box. When a value is selected in this drop down box, Frame_2 is updated using an...
9
by: Morlaath | last post by:
Is there a way to embed php within javascript code? I know that php is server side and js is client side. For instance when working with jsp, you can imbed jsp scriptlets within the js code. e.g...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.