473,383 Members | 1,863 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,383 software developers and data experts.

JavaScript

Hi all,

I like to use some JavaScript on my ASPX Page. But whatever
I'm trying it doesn't work.

The basic code of the ASPX Page is:

<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="WebForm1.aspx.vb" Inherits="ASP_Check.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio
..NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body MS_POSITIONING="GridLayout">

<form id="Form1" method="post" runat="server">

</form>

</body>
</html>

And now my timer, working within a simple HTML Page:

<html>
<head>
<title>HTMLPage1</title>

<HEAD>

<SCRIPT LANGUAGE="JavaScript">

function showZeroFilled(inValue) {
if (inValue > 9) {
return "" + inValue;
}
return "0" + inValue;
}

function showTheTime() {
now = new Date
document.form.showTime.value =
showZeroFilled(now.getHours()) + ":" +
showZeroFilled(now.getMinutes()) + ":" +
showZeroFilled(now.getSeconds())
setTimeout("showTheTime()",1000)
}

</script>

<BODY onLoad="showTheTime()">

<BODY>

<center><form name=form>
<input type=text name=showTime size=11><p>

</form></center>

</html>

What is the correct way, to make this timer working on my
aspx Page??

Thanks a lot!!

Rob
Nov 17 '05 #1
3 8325
Try adding ";" to the end of the statements in
showTheTime, and also use the form name, ie
document.form1.showTime.value

rgds
Richard
-----Original Message-----
Hi all,

I like to use some JavaScript on my ASPX Page. But whateverI'm trying it doesn't work.

The basic code of the ASPX Page is:

<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="WebForm1.aspx.vb" Inherits="ASP_Check.WebForm1"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html>
<head>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio..NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1"> <meta name=vs_defaultClientScript content="JavaScript"> <meta name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body MS_POSITIONING="GridLayout">

<form id="Form1" method="post" runat="server">

</form>

</body>
</html>

And now my timer, working within a simple HTML Page:

<html>
<head>
<title>HTMLPage1</title>

<HEAD>

<SCRIPT LANGUAGE="JavaScript">

function showZeroFilled(inValue) {
if (inValue > 9) {
return "" + inValue;
}
return "0" + inValue;
}

function showTheTime() {
now = new Date
document.form.showTime.value =
showZeroFilled(now.getHours()) + ":" +
showZeroFilled(now.getMinutes()) + ":" +
showZeroFilled(now.getSeconds())
setTimeout("showTheTime()",1000)
}

</script>

<BODY onLoad="showTheTime()">

<BODY>

<center><form name=form>
<input type=text name=showTime size=11><p>

</form></center>

</html>

What is the correct way, to make this timer working on my
aspx Page??

Thanks a lot!!

Rob
.

Nov 17 '05 #2
I tried your code, it is working perfectely in my IE 6.0.. btw in which
browser your testing this code

--
Saravana
Microsoft India Community Star,
MCAD,SE,SD,DBA.
"Robert" <ro*******@gmx.com> wrote in message
news:09****************************@phx.gbl...
Hi all,

I like to use some JavaScript on my ASPX Page. But whatever
I'm trying it doesn't work.

The basic code of the ASPX Page is:

<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="WebForm1.aspx.vb" Inherits="ASP_Check.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio
.NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body MS_POSITIONING="GridLayout">

<form id="Form1" method="post" runat="server">

</form>

</body>
</html>

And now my timer, working within a simple HTML Page:

<html>
<head>
<title>HTMLPage1</title>

<HEAD>

<SCRIPT LANGUAGE="JavaScript">

function showZeroFilled(inValue) {
if (inValue > 9) {
return "" + inValue;
}
return "0" + inValue;
}

function showTheTime() {
now = new Date
document.form.showTime.value =
showZeroFilled(now.getHours()) + ":" +
showZeroFilled(now.getMinutes()) + ":" +
showZeroFilled(now.getSeconds())
setTimeout("showTheTime()",1000)
}

</script>

<BODY onLoad="showTheTime()">

<BODY>

<center><form name=form>
<input type=text name=showTime size=11><p>

</form></center>

</html>

What is the correct way, to make this timer working on my
aspx Page??

Thanks a lot!!

Rob

Nov 17 '05 #3
Hi

There should be no problem doing this even its aspx, are you accessing it
correctly?

Example:
<form name="myForm"....
<input type="text" name="boxShowTime"....

<body onload="setInterval('showTime()',1000)">

function showTime(){
var d = new Date();
with(document.forms["myForm"])
{
boxShowTime.value = padIt(d.getHours()) + ":" + padIt(d.getMinutes())
+ ":" + padIt(d.getSeconds());
}
}
function padIt(v){
return ( v < 10 ) ? ( "0" + v) : v;
}

onload is probably the best way to fire the script.... If you dont use that
you could check the readyState of the document ( Explorer )

function showTime(){
if(!document.readyState) return;// Bail out as readyState is not supported
if(document.readyState == "complete")
{ // Oki do the clock... Using div to show you another way to do this :)
if(document.getElementById)
{
var e = document.getElementById("myClock");
if(e!= null)
{
var d = new Date();
e.innerHTM = padIt(d.getHours()) + ":" + padIt(d.getMinutes()) + ":"
+ padIt(d.getSeconds());
}
}
}
}
And the placeholder like so.....
<div ID="myClock" style="color:red;font-size:12px"></div>

--
Best Regards
Vidar Petursson
==============================
Microsoft Internet Client & Controls MVP
==============================
"Robert" <ro*******@gmx.com> wrote in message
news:09****************************@phx.gbl...
Hi all,

I like to use some JavaScript on my ASPX Page. But whatever
I'm trying it doesn't work.

The basic code of the ASPX Page is:

<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="WebForm1.aspx.vb" Inherits="ASP_Check.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio
.NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body MS_POSITIONING="GridLayout">

<form id="Form1" method="post" runat="server">

</form>

</body>
</html>

And now my timer, working within a simple HTML Page:

<html>
<head>
<title>HTMLPage1</title>

<HEAD>

<SCRIPT LANGUAGE="JavaScript">

function showZeroFilled(inValue) {
if (inValue > 9) {
return "" + inValue;
}
return "0" + inValue;
}

function showTheTime() {
now = new Date
document.form.showTime.value =
showZeroFilled(now.getHours()) + ":" +
showZeroFilled(now.getMinutes()) + ":" +
showZeroFilled(now.getSeconds())
setTimeout("showTheTime()",1000)
}

</script>

<BODY onLoad="showTheTime()">

<BODY>

<center><form name=form>
<input type=text name=showTime size=11><p>

</form></center>

</html>

What is the correct way, to make this timer working on my
aspx Page??

Thanks a lot!!

Rob

Nov 17 '05 #4

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

Similar topics

1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.