Auto Update field based on date
I need to update a field based off date. What I want to do is have a hidden date field that would then add to another field to give me a number based off the date. I did this in excel with this formala:
=(TODAY()-A4)+B4
In A4 I have my date entered. In b4 I have the number I want to add to the date. The answer is then displayed in whatever cell I put this formula in. I need to do the same thing in HTML. Any help appreciated.
Using Excel forumlas in HTML?
This possible? If so, how do I do it?
Re: Using Excel forumlas in HTML?
No, it is not possible. You'll need to use a scripting language; whether you use a client-side language (Javascript) or a server-side language (PHP, ASP, etc.) depends on what you want to do, and how you want to do it.
Re: Using Excel forumlas in HTML?
crap. Well I have a formula in excel. I need the same outcome to work in HTML. This is what I need:
I am working on an HTML project that displays a field with a number in the field by each day. What it does is start at 0 on day one. Each day it adds a 1 to the field. Day 2, the field would say 1, then day 3 would say 2, and so on. I am not sure how to approach this. This is also displayed in an HTML format. So is the best method to pull the VB code in somehow to the html field? or is xml the best method? Regardless, just need some help in writing the code and adding it to the html. Thanks in advance.
Javascript to add excel forumla?
I have this forumla:
=(TODAY()-A4)+B4
I have a date in A4 plus a number in b4. How do I make this work so that I can display this in an HTML format? I was told I would have to use javascript if I want to use a forumla from excel.
Re: Using Excel forumlas in HTML?
How familiar (or unfamiliar) are you with HTML? What you'll want to start with is a <form> element with some <input> elements to retrieve and display data. Can you begin writing that?
Re: Auto Update field based on date
Duplicate threads merged - please post each question (or variation of it) only once.
Re: Auto Update field based on date
here is what I have:
Code:
<head>
<style type="text/css">
.auto-style1 {
font-size: 120pt;
font-weight: bold;
}
.auto-style2 {
color: #FF0000;
font-size: 100pt;
}
.auto-style3 {
font-size: 95pt;
}
</style>
</head>
<font color=red><center><p class="auto-style1">Safety First</p></center></font>
<html>
<head>
<script type="text/javascript">
// 6 Decemeber 2010, just for demo purposes:
var startDate = new Date( 2010, 11, 6 );
function setNumberInField( fld )
{
var now = new Date();
var diff = now.getTime() - startDate.getTime();
var days = Math.floor( diff / ( 24 * 60 * 60 * 1000 ) );
fld.innerHTML = days;
}
</script>
</head>
</br/>
</body>
</html>
</font><center><p style="font-size:500%"><span id="zamboni" class="auto-style2">HERE</span><font color=navy>
<span class="auto-style3">Days without</span></p></font></center>
<font color=navy><center><p class="auto-style3">a Lost Time Accident</p></center></font>
function delayer() {
window.location = "./test2.html";
}
</script>
</head>
<body onload = "setNumberInField(document.getElementById('zamboni'));setTimeout('delayer()', 5000)">
Now I get the days to auto update by date but now I need this page to loop between the two html files. Page 1 that this code is in is a saftey sheet. Page two is called test2. It will not go to test2.html and they are in the same directory.
Re: Auto Update field based on date
Your HTML is a mess. An HTML document needs to contain only one set of each: <html>, <head> and <body> tags. The <head> and <body> need to be nested in <html>. So, start like this:
Code:
<html>
<head></head>
<body></body>
</html>
(a doctype is usually good too)
Your page content goes in between the <body> tags. <style> and <script> blocks can go in either the <head> or the <body> section.
Your delayer() function isn't working because it isn't contained in <script> tags (there is a closing tag, but no opening tag). Also if the pages are in the same directory, don't put "./test2.html" for window.location, just "test2.html" will do.