Could you do the time in 24 hour system. The AM/PM is a bit odd from my perspective.
Sorry to be so demanding. :o
Printable View
Could you do the time in 24 hour system. The AM/PM is a bit odd from my perspective.
Sorry to be so demanding. :o
Here is another version:
Code:
<script language="JavaScript">
now = new Date();
localtime = now.toString();
utctime = now.toGMTString();
document.write("<b>Local time:</b> " + localtime + "<BR>");
document.write("<b>UTC time:</b> " + utctime + "</p>");
</script>
Bill or Steve, how do you "remark/comment" a line?
Would it be practical to add a "bunch" of lines for date and time options with a comment in between each to explain.
Then user could remark out (or delete) those lines they don't wish to use.
JC
Here is another to display a calendar:
Code:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var now = new Date();
var month_array = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
document.write("<form name=date_list><table bgcolor=#c5c5c5 border=1 bordercolor=#2e2e2e width='200'><tr><td>");
document.write("<select name=month onchange=change_month(this.options.selectedIndex)>");
for(i=0;i<month_array.length;i++)
{
if (now.getMonth() != i)
{document.write ("<option value="+i+">"+month_array[i]);}
else
{document.write ("<option value="+i+" selected>"+month_array[i]);}
}
document.write("</select>");
document.write("</td><td>");
document.write ("<select name=year onchange=change_year(this.options[this.options.selectedIndex])>");
for(i=2002;i<2100;i++)
{
if (now.getYear() != i)
{document.write("<option value="+i+">"+i);}
else
{document.write("<option value="+i+" selected>"+i);}
}
document.write("</select></td></tr><tr><td colspan=2><center>");
document.write("<table bgcolor=white border=1 cellspacing = 0 cellpading = 0 width=100%><tr bgcolor=2e2e2e align=center>");
document.write("<td><font color=white>S</font></td><td><font color=white>M</td><td><font color=white>T</td><td><font color=white>W</td><td><font color=white>T</td><td ><font color=white>F</td><td ><font color=white>S</td>");
document.write("</tr><tr>");
for(j=0;j<6;j++)
{
for(i=0;i<7;i++)
{
document.write("<td align=center id=d"+i+"r"+j+"></td>")
}
document.write("</tr>");
}
document.write("</table>");
document.write("</center></from></td></tr></table>");
var show_date = new Date();
function set_cal(show_date)
{
begin_day = new Date (show_date.getYear(),show_date.getMonth(),1);
begin_day_date = begin_day.getDay();
end_day = new Date (show_date.getYear(),show_date.getMonth()+1,1);
count_day = (end_day - begin_day)/1000/60/60/24;
input_table(begin_day_date,count_day);
}
set_cal(show_date);
function input_table(begin,count)
{
init();
j=0;
if (begin!=0){i=begin-1;}else{i=6}
for (c=0;c<count+1;c++)
{
colum_name = eval("d"+i+"r"+j);
if ((now.getDate() == c)&&(show_date.getMonth() == now.getMonth())&&(show_date.getYear() == now.getYear())) {colum_name.style.backgroundColor = "55ffff";colum_name.style.color = "000000";};
if (c>0) {colum_name.innerText = c};
i++;
if (i==7){i=0;j++;}
}
}
function init()
{
for(j=0;j<6;j++)
{
for(i=0;i<7;i++)
{
colum_name = eval("d"+i+"r"+j);
colum_name.innerText = "-";
colum_name.style.backgroundColor ="";
colum_name.style.color ="";
}
}
}
function change_month(sel_month)
{
show_date = new Date(show_date.getYear(),sel_month,1);
set_cal(show_date);
}
function change_year(sel_year)
{
sel_year = sel_year.value;
show_date = new Date(sel_year,show_date.getMonth(),1);
set_cal(show_date);
}
// End -->
</script>
Thank you Bill.
That is a nice version, except for me there is too much stuff. :)
I just need something like this: 23:39:12
That calendar comes in need. I need to mock up date selectors all the time and that fits the bill. I need to see if it is visually configurable. Thanks for that Bill.
I've updated my .web file to include a number of options such as your request.Quote:
I just need something like this: 23:39:12
In case someone needs the example I was looking for here is the badly modified code which works anyway.
Looks close to this:
23:12:55
Code:<div style="font:Arial, Helvetica, sans-serif; font-size:14px; color:#8fe200">
<script type="text/javascript">
<!--
var currentTime = new Date()
var hours = currentTime.getHours()
var minutes = currentTime.getMinutes()
var seconds = currentTime.getSeconds()
if (hours < 10){
hours = "0" + hours
}
if (minutes < 10){
minutes = "0" + minutes
}
if (seconds < 10){
seconds = "0" + seconds
}
document.write(hours + ":" + minutes + ":" + seconds)
//-->
</script>
</div>
Thanks Steve for the .web file. That comes handy for sure.
Mark the attached .web file contains an update to the previous calendar.
This update highlights in yellow the day a person clicks. I used a variation that submits the date as a parameter for a server side script. If you need to use it in a similar fashion let me know and I can help you setup the action portion of the script.
Hi JC,
Sorry for not responding sooner.
Comments in javascript can be a single line or a block of text.
Use double forward slashes for a single line comment. // this is a comment
A block of text can be made a comment by starting with a forward slash and asterisk. /* this begins a block comment.
To end the block comment use asterisk and forward slash. */ this ends a block comment.
Thanks Bill, Steve & Markku. Couple of problems though :(
The time stamps are static in both FF3 & IE8 and your calendar Bill appears - as below - in FF ... though it appears fine in IE (have to wait till tomorrow to check if it's static too :p) I have JavaScript enabled in FF btw.
Sorry to be a pain :o
John the time and calendars are static unless you force a page refresh.
I never tried the calendar in any browser except for IE. The company I wrote code for only allowed IE on their machines and all the pages were strictly intranet (not internet) accessible.
Ah, OK, thanks Bill. At least it's not my machine :)
A good cross browser calendar can be found at
http://www.richarea.com/demo/rich_calendar/
Bill, your calendar is very nice.
I've managed to figure out how to change the colors of the table, current date cell color, beginning year, and a few other things.
I can't see how to scale down the table size (it seems it has a minimum width of 200pix and heigth of 193pix).
What I'd like to do in reduce the Height of the entire table down to 170 pix and, if necessary, scale the font size down.
If you can show me what code to change, I can edit my placeholder.
JohnC
[Edit] see below. Thanks, Steve. Hope its not an Aussy Calendar is it?..:eek:
I see you added font size = 1 What does the 1 do? Does is that tell the browser to use a minimum value?
[Edit]
It is all prefectly clear now:rolleyes:
The user picks a preferred length value in prefs. You figure out the pixels-per-em (based on the logical res if an absolute length such as a "point" size). Then you calculate the values of the keyword sizes according to the scaling factors given in the "synoptic table" above. If the user changes the font size via a "topside" (non-prefs-based, transient) affordance, you traverse the keyword size scale........So, it is a lowest scale factor? If you want, your reply could be a tx'd to a new post.
Here's Bill's calendar 'Taylored' ( :D ) to suit.
Yes I'm afraid it is an Eastern Australian Calendar therefore you will have to set your clocks, watches, computer and sundial to GMT+10 :D
I have wrapped Bill's <script> with <font size=1> which tells the browser to use a font size interval of '1' for all font tags within the script.
Steve, Bill and others,
Thanks for the input on the script... gives me something to play with.
Rupert
Thanks Bill :)
Hi John,
I'm getting errors with this (floating window that follows scrolling) in my trusted Firefox and some odd stuff in Safari too. In Firefox it offsets content to the left and off the page when you start scrolling the page.
In Chome and IE7 it works perfectly.
Is there anything you could do about it? Thanks.
I don't know. It works perfect in FF here. I may need to see the failing example for further assistance.
My mistake again. I had two named objects with the same name but on a different page and that was causing issues with IE and Firefox. Different issues on those browsers, but when I renamed the other object, then everything started working nicely again.
John, your scripts are working flawlessly. Sorry fro wrong report.
For reasons such as this it would be good to be able to see a listing of names within a project and be able to find/highlight the duplicates.
I was trying out the history buttons in the tweaks set, but couldn't get them to work as intended. Looking at the links, I noticed that the buttons are linked to www.xara.com. Am I missing something? :confused:
I tried again and you're right, now they show javascript in the links. Bizarre, but issue solved. Thanks! :)
Look at your folder selection dialog before you click Add. It has look like the one on the screenshot.
Hi John,
Just going thru the tweaks html - thank you again!
Really liked your presentation of the material.
A brief tutorial on the steps you took to do this exact pageset would be a great thing!
I'd like to use the format for training materials, myself.:)
Cheers!
HimAGAIN
I'm using covoxer's sticky popup script heavily. I really hope that it will be implemented natively into WD.
While it is still a tweak, I hope John would improve it just a little more by making it possible (as an option) to automatically close all other open (sticky) popups without the author having to write numerous my_close statements.
I'm envisioning it to work like this:Is that possible?Code:my_close('all_popups');
One more question; is it wrong/will it create an error is I exclusively define all my popups to be closed, yet just a few of them are open at the moment?
Thanks, that is good to know.
I'm toying with the Locking PopUp tweak and can't seem to make it work. Any ideas why not?Quote:
Originally Posted by Tweak Instructions
So ... what's wrong? Thanks. :)
- I dragged the Locking Popups unit from the Design Gallery Tweaks onto my webpage.
- I created a pair of objects (black squares) that call a pair of popup layers (identifying them as 'popup' layers).
- I created a pair of buttons that should turn on/off the locked layers, and inserted [what I understood to be] the proper javascript to direct the action.
There is no 'Locking PopUp tweak' on the page that I can find.
It's not just instructions, it's a placeholder which has the code necessary for it to work.
I deleted it, thinking that it was a simply a set of instructions. Even when present, I got a "missing object" message. I've attached the .web file WITH the placeholder to this post. Thanks for any help that you can offer.
Hi,
i think there is a bug in WD.
You named one of you popup-objects o_zero right? Take a look in the generated source, WD replaced the "z" with ":122".
See the ID-Tags in the HTML-Code:
All "z" in object-names are replaced with ":122", try it :)HTML Code:<img class="xr_ap" src="index_htm_files/2.png" alt="" id="o_:122ero" style="left: 141px; top: 21px; width: 485px; height: 444px;"/>
</div>
<div id="pu_:122ero" style="left: 383px; position: absolute; font-size: 96px; font-family: Lucida Sans; text-align: center; font-weight: bold; color: #7F7F7F; top: 269px;" onmousemove="xr_mpc(1)" >
Use the name "zombi" and WD convert it to "xa:122ombi" or "ZzZzZzZzZ" is converted to "Z:122Z:122Z:122Z:122Z".
All lowercase "z" will be converted to ":122" with your TEMP.WEB.
Can you confirm that?
Interesting observation. It seems like a small mistake in html filter, so I'm going to fix it for the following update. Meanwhile, avoid using lowercase "z" in the object names that you manually refer by ID in your code (or tweaks).
Thank you for pointing this out.
If anyone wonder why there's any substitution like this, I shall explain. The HTML specification does not allow for any text to be used as ID value of the element. It has following restrictions:
- ID can only contain English letters of both cases: A..Z, a..z, digits: 0..9, and following characters: "_", "-", ":", ".".
- ID can begin only with a letter: A..Z, a..z.
So, when user sets inappropriate text as a name of the object in WD, it is a bit encoded to represent correct ID string. Though the 'z' character is allowed and should not be encoded as it is.
Are we anywhere close to getting a revised version of XWD .......