473,581 Members | 2,979 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Who can help me? My fist Asp paga, doesnt work

Wen
Hi everyone,
..After my first lesson, I have to create a asp page with:
..asp tag for time
..client script that runs at the server for date
..client script that runs at client and shows a messagebox
These are my code, but it doenst work. Can someone help me?

<html>
<head>
<title>18 Nov 2004 My first ASP page</title>
</head>
<body>
<script language="javas cript" runat="server">
var d = new Date()
var dd = d.getDate()
var mm = d.getMonth()
var yyyy = d.getFullYear() ;
var datum = dd + "-" + mm + "-" + yyyy
</script>

<script language="javas cript">
alert("<% = Time %> " + " on " + datum)
</script>
</body>
</html>

Thanks at advance
Wen
Jul 22 '05 #1
7 1651
What message are you getting?

"Wen" <we************ **********@hccn et.nl> wrote in message
news:cn******** **@news.cistron .nl...
Hi everyone,
.After my first lesson, I have to create a asp page with:
.asp tag for time
.client script that runs at the server for date
.client script that runs at client and shows a messagebox
These are my code, but it doenst work. Can someone help me?

<html>
<head>
<title>18 Nov 2004 My first ASP page</title>
</head>
<body>
<script language="javas cript" runat="server">
var d = new Date()
var dd = d.getDate()
var mm = d.getMonth()
var yyyy = d.getFullYear() ;
var datum = dd + "-" + mm + "-" + yyyy
</script>

<script language="javas cript">
alert("<% = Time %> " + " on " + datum) </script>
</body>
</html>

Thanks at advance
Wen

Jul 22 '05 #2
datum is a server-side variable, so you need to write it into your HTML in
order for it to appear at the client. And you'll actually be writing the
variable's value, not the variable. The browser will not have any idea what
"datum" is, since that variable exists at the server level.

alert("<%=datum %>");

Ray at work

"Wen" <we************ **********@hccn et.nl> wrote in message
news:cn******** **@news.cistron .nl...
Hi everyone,
.After my first lesson, I have to create a asp page with:
.asp tag for time
.client script that runs at the server for date
.client script that runs at client and shows a messagebox
These are my code, but it doenst work. Can someone help me?

<html>
<head>
<title>18 Nov 2004 My first ASP page</title>
</head>
<body>
<script language="javas cript" runat="server">
var d = new Date()
var dd = d.getDate()
var mm = d.getMonth()
var yyyy = d.getFullYear() ;
var datum = dd + "-" + mm + "-" + yyyy
</script>

<script language="javas cript">
alert("<% = Time %> " + " on " + datum)
</script>
</body>
</html>

Thanks at advance
Wen

Jul 22 '05 #3
Exactly as your words. I've got a error "datum not define". But how do I put
the variable's value to alert box?
Best Regards
Wen
"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> schreef in
bericht news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
datum is a server-side variable, so you need to write it into your HTML in
order for it to appear at the client. And you'll actually be writing the
variable's value, not the variable. The browser will not have any idea
what "datum" is, since that variable exists at the server level.

alert("<%=datum %>");

Ray at work

"Wen" <we************ **********@hccn et.nl> wrote in message
news:cn******** **@news.cistron .nl...
Hi everyone,
.After my first lesson, I have to create a asp page with:
.asp tag for time
.client script that runs at the server for date
.client script that runs at client and shows a messagebox
These are my code, but it doenst work. Can someone help me?

<html>
<head>
<title>18 Nov 2004 My first ASP page</title>
</head>
<body>
<script language="javas cript" runat="server">
var d = new Date()
var dd = d.getDate()
var mm = d.getMonth()
var yyyy = d.getFullYear() ;
var datum = dd + "-" + mm + "-" + yyyy
</script>

<script language="javas cript">
alert("<% = Time %> " + " on " +
datum)
</script>
</body>
</html>

Thanks at advance
Wen


Jul 22 '05 #4
You'd do that just as I included in my previous reply. What you're looking
to do is take the value of a server-side variable, and write it to the HTML
of the page, whether that be actually in a javascript function, or in a div,
or in the <title> tag, it's all the same.

<title><%=datum %></title>
<div>Here's the value of the variable from the server: <%=datum%></div>
<script type="text/javascript">ale rt('<%=datum%>' );</script>

Ray at work

"Kees Hoogendijk" <ni********@haa lditweg-hcopleidingen.n l> wrote in message
news:cn******** **@news.cistron .nl...
Exactly as your words. I've got a error "datum not define". But how do I
put the variable's value to alert box?
Best Regards
Wen
"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> schreef in
bericht news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
datum is a server-side variable, so you need to write it into your HTML
in order for it to appear at the client. And you'll actually be writing
the variable's value, not the variable. The browser will not have any
idea what "datum" is, since that variable exists at the server level.

alert("<%=datum %>");

Ray at work

"Wen" <we************ **********@hccn et.nl> wrote in message
news:cn******** **@news.cistron .nl...
Hi everyone,
.After my first lesson, I have to create a asp page with:
.asp tag for time
.client script that runs at the server for date
.client script that runs at client and shows a messagebox
These are my code, but it doenst work. Can someone help me?

<html>
<head>
<title>18 Nov 2004 My first ASP page</title>
</head>
<body>
<script language="javas cript" runat="server">
var d = new Date()
var dd = d.getDate()
var mm = d.getMonth()
var yyyy = d.getFullYear() ;
var datum = dd + "-" + mm + "-" + yyyy
</script>

<script language="javas cript">
alert("<% = Time %> " + " on " +
datum)
</script>
</body>
</html>

Thanks at advance
Wen



Jul 22 '05 #5
Wen
Hi Ray,
Thank you so much!! It works.
Best regards.
Wen

"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:ut******** ******@TK2MSFTN GP11.phx.gbl...
You'd do that just as I included in my previous reply. What you're looking to do is take the value of a server-side variable, and write it to the HTML of the page, whether that be actually in a javascript function, or in a div, or in the <title> tag, it's all the same.

<title><%=datum %></title>
<div>Here's the value of the variable from the server: <%=datum%></div>
<script type="text/javascript">ale rt('<%=datum%>' );</script>

Ray at work

"Kees Hoogendijk" <ni********@haa lditweg-hcopleidingen.n l> wrote in message news:cn******** **@news.cistron .nl...
Exactly as your words. I've got a error "datum not define". But how do I
put the variable's value to alert box?
Best Regards
Wen
"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> schreef in bericht news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
datum is a server-side variable, so you need to write it into your HTML
in order for it to appear at the client. And you'll actually be writing the variable's value, not the variable. The browser will not have any
idea what "datum" is, since that variable exists at the server level.

alert("<%=datum %>");

Ray at work

"Wen" <we************ **********@hccn et.nl> wrote in message
news:cn******** **@news.cistron .nl...
Hi everyone,
.After my first lesson, I have to create a asp page with:
.asp tag for time
.client script that runs at the server for date
.client script that runs at client and shows a messagebox
These are my code, but it doenst work. Can someone help me?

<html>
<head>
<title>18 Nov 2004 My first ASP page</title>
</head>
<body>
<script language="javas cript" runat="server">
var d = new Date()
var dd = d.getDate()
var mm = d.getMonth()
var yyyy = d.getFullYear() ;
var datum = dd + "-" + mm + "-" + yyyy </script>

<script language="javas cript">
alert("<% = Time %> " + " on " +
datum)
</script>
</body>
</html>

Thanks at advance
Wen



Jul 22 '05 #6
"Wen" <we************ **********@hccn et.nl> wrote in message
news:cn******** **@news.cistron .nl...
Hi everyone,
.After my first lesson, I have to create a asp page with:
.asp tag for time
.client script that runs at the server for date
.client script that runs at client and shows a messagebox
These are my code, but it doenst work. Can someone help me?

<html>
<head>
<title>18 Nov 2004 My first ASP page</title>
</head>
<body>
<script language="javas cript" runat="server">
var d = new Date()
var dd = d.getDate()
var mm = d.getMonth()
var yyyy = d.getFullYear() ;
var datum = dd + "-" + mm + "-" + yyyy
</script>

<script language="javas cript">
alert("<% = Time %> " + " on " + datum)
</script>
</body>
</html>

Thanks at advance
Wen


What do you call the file name? Where do you save it? How are you trying
to run/view it?
Jul 22 '05 #7
Wen wrote:
Hi Ray,
Thank you so much!! It works.


Not quite. JScript uses 0-based months, so you may want to use d.getMonth()
+ 1.

ALSO -- A note of caution: This only works because the default server-side
language is VBScript. I know this because you are mixing <script
runat=server> with <%%> blocks, and there is an order of operations. To see
this in action, move your server-side JScript block to the very end of your
script, and you'll note that it still works:
<script language="javas cript">
alert("<%=Time% > on <%=datum%>")
</script>

<script language="JScri pt" runat="server">
var d = new Date()
var dd = d.getDate()
var mm = d.getMonth()
var yyyy = d.getFullYear() ;
var datum = dd + "-" + mm + "-" + yyyy
</script>

A far better approach to mixing languages on the server is to encapsulate
those elements into functions (or Subs). Either of those can be called from
any other block, regardless of the parsing order. Example:

<script language="javas cript">
alert("<%=Time% > on <%=getDate()%>" )
</script>

<script language="JScri pt" runat="server">
function getDate() {
var d = new Date()
return d.getDate() + "-" +
d.getMonth() + "-" +
d.getFullYear()
}
</script>
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 22 '05 #8

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

Similar topics

0
3413
by: abcd | last post by:
kutthaense Secretary Djetvedehald H. Rumsfeld legai predicted eventual vicmadhlary in Iraq mariyu Afghmadhlaistmadhla, kaani jetvedehly after "a ljetvedehg, hard slog," mariyu vede legai pressed Pentagjetvedeh karuvificials madhla reachathe strategy in karkun campaign deshatinst terrorism. "mudivae maretu winning or losing karkun global...
11
4949
by: Goonigooguu | last post by:
Help! I am looking to download an evaluation version of Microsoft Visual Studio 6.0 to practice some C++ programming or alternatively a similar program which is easy to use and learn basic C++ on. Can anyone point me in the right direction please? -- ..... and then he stuck a G.I. Joe up his ass!
16
2139
by: Andrew Baker | last post by:
I am trying to write a function which provides my users with a file filter. The filter used to work just using the VB "Like" comparision, but I can't find the equivilant in C#. I looked at RegEx.IsMatch but it behaves quite differently. Is there a way I can mimic the DOS filtering of filenames (eg. "*.*" or "*" returns all files, "*.xls"...
2
1045
by: Simon Harvey | last post by:
Hi everyone, I'm having a problem with getting a control that I'm using to work. I have a placeholder control sitting within a user control. On certain occasions at runtime I create a Textbox control and add it to the placeholder. This works well almost all the time. Unfortunately there is one scenario when it doesnt work. The textbox...
36
3456
by: felixnielsen | last post by:
What i really wanna do, is defining my own types, it doesnt really matter why. Anyway, i have run into some problems 1) typedef unsigned short U16; U16 test = 0xffffffff; // There should be a limit on this, max value you should be able to asign should be 0xffff // std::cout << test; // result = 0xffff //
4
2140
by: placid | last post by:
Hi all, I have the following class code for a Node for a Linked List, (saved in node.py) class Node : def __init__(self,element): self.element = element self.next = None
1
3122
by: m3zmeriz3d | last post by:
i typed a function to enter data into a file to be recalled later, now i have done something here and as soon as this function begins it skips the first 'zips' getline and makes it a blank space and goes directly to 'city' - someone please tell me what the hell happenned here - g'day - mark void addData() { string zips = ""; string city...
8
1596
by: [rob desbois] | last post by:
I've not really used sequence algorithms before and am having some trouble interpreting usage from The C++ Programming Language . The effect I'd like to achieve is to copy all entries (key and value) from map<string, stringsource to dest - without overwriting any entries in dest unless the keys match, ie: for (map<string,...
8
1690
by: wastedhello | last post by:
ok. here are a list of things i cant fix. ive been trying for way to long now. 1. if more then 1000 values are told, will still continue with program. 2. if -max, min, average etc run, and 2 values are given they will work, but will cause a random segmentation fault. (BUT only with giving two values.) 3. -average doesnt give average. 4....
0
7886
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8312
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7920
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6569
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5685
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5366
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3835
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1413
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1147
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.