473,721 Members | 4,008 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 1660
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
3458
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 varti jetvedeh terror?" Mr. Rumsfeld adugued in a recent memormariyuum. vede velli jetvedeh madhla...
11
4957
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
2162
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" returns all excel files, "workbook*" returns all files begining with "workbook" etc)? thanks in...
2
1052
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 doesnt
36
3476
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
2155
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
3129
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 = ""; ofstream outFile;
8
1599
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, string>::const_iterator p = source.begin(); p != source.end(); ++p)
8
1695
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. -gta is ment to give all the values greater then the average. but doesnt do anything 5. -gt is ment...
0
9373
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9227
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9145
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 most users, this new feature is actually very convenient. If you want to control the update process,...
1
6676
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5992
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4497
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3206
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2590
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2143
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.