473,324 Members | 2,179 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,324 software developers and data experts.

How to update the page ?

Hi,

I want to show the value of a counter-variable that is incremented with a
button. How do I refresh the page after the button is pressed ? Looks pretty
basic but I cannot find the answer in the books.....
Below is a simple example that shows what I want

Ton den Hartog

<html>
<head>
<script type='text/javascript'>
function inc()
{
count=count+1;
// how to refresh now ??
}
</script>
</head>
<body>
<script type='text/javascript'>
var count
count=0;
</script>
<script type='text/javascript'>
document.write("Count is now "+count);
</script>
<input type=button id=date_edit value='...' OnClick='inc();'>
</body>
</html>
Jul 20 '05 #1
2 1859
> > "news.dev.ict.nl" <to**@xs4all.nl> wrote
Hi,

I want to show the value of a counter-variable that is incremented
with
a button. How do I refresh the page after the button is pressed ?
Looks pretty
basic but I cannot find the answer in the books.....
Below is a simple example that shows what I want

Ton den Hartog

<html>
<head>
<script type='text/javascript'>
function inc()
{
count=count+1;
// how to refresh now ??
}
</script>
</head>
<body>
<script type='text/javascript'>
var count
count=0;
</script>
<script type='text/javascript'>
document.write("Count is now "+count);
</script>
<input type=button id=date_edit value='...' OnClick='inc();'>
</body>
</html>

"Gill Bates" <g.*****@mothail.com> wrote
If you only want the number client-side the best would be to stuff
the value
in something with an id, so you can easily reference it with a
JavaScript DOM call and change it's value.

"Ton den Hartog" <to**@xs4all.nl> wrote But after the value is changed the text does not automatically change, how do I accomplisch that ?

Ton

Hi Ton, try this example...

<html>
<head>
<script type="text/javascript">

var count = 0;

function inc()
{
count = count + 1;
document.getElementById('x').firstChild.nodeValue = count;
}

</script>
</head>
<body>
<p>Count is now <span id="x">0</span></p>
<form>
<input type="button" id="date_edit" value="..." onclick="inc()">
</form>
</body>
</html>

Hope this helps

Geoff


Jul 20 '05 #2
> count = count + 1;
document.getElementById('x').firstChild.nodeValue = count;
<input type="button" id="date_edit" value="..." onclick="inc()">


Hi, thanks but my real problem is more complex... :-) I have a big table
with javascript with document.write's in them that print text dependent upon
a integer value that changes.
I already thought about putting the value in a cooky and than reloading the
whole page but I thought it could be done differently....

Ton


Jul 20 '05 #3

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

Similar topics

5
by: Alastair Anderson | last post by:
I have created a very simple form with which I would like to update a single value in a single row of a database as a proof of concept. The relevant parts of the form are a DBWebTextBox (which...
4
by: Jonathan Upright | last post by:
Greetings to anyone who can help: I'm using WebMatrix to make ASP.NET pages, and I chose the "Editable DataGrid" at the project selector screen. As you may know, it defaults to the Microsoft...
0
by: Metal2You | last post by:
I'm working on an ASP.NET 2.0 application in Visual Studio 2005 that accesses a Sybase database back end. We're using Sybase SQL Anywhere 9.0.2.3228. I have installed and registered the Sybase...
1
by: MORALBAROMETER | last post by:
Hi all, I want to update MULTIPLE elements of an HTML page using Ajax. for this reason i my response is an xml document. I want to use XSL at the client side to update these elements. How can i...
1
by: Evan M. | last post by:
Here's my GridView and my SqlDataSource <asp:GridView ID="ContactHistoryGrid" runat="server" AutoGenerateColumns="False" DataSourceID="ContactHistoryDS" DataKeyNames="JobHistoryID"...
60
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I prompt a "Save As" dialog for an accepted mime type?...
3
by: Kristijan Marin | last post by:
Hi, I need to print a report like document. So in report there are many articles and what I need when I get to the end, is to update page numbers on the second page where the Table of Content...
11
by: SAL | last post by:
Hello, I have a Gridview control (.net 2.0) that I'm having trouble getting the Update button to fire any kind of event or preforming the update. The datatable is based on a join so I don't know...
3
by: Michel Esber | last post by:
Hi all, DB2 V8 LUW FP 15 There is a table T (ID varchar (24), ABC timestamp). ID is PK. Our application needs to frequently update T with a new value for ABC. update T set ABC=? where ID...
2
by: sirdavethebrave | last post by:
Hi guys - I have written a form, and a stored procedure to update the said form. It really is as simple as that. A user can go into the form, update some fields and hit the update button to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.