• Quick note - the problem with Youtube videos not embedding on the forum appears to have been fixed, thanks to ZiprHead. If you do still see problems let me know.

Web Site programming

Why does this discussion have to descend to insults?

Have you considered that, in the absence of arguments, it looks like you are arguing just for the hell of it?

My main point was to defend WYSIWYG

:confused: Defend it from what? Accusations that, in the context of web pages, the concept of WYSIWYG is nothing more than a myth?

I made some sideline points about the relative importance of HTML in the future of internet applications

Relative to what?

I am very happy for my opinion to be challenged

Cool!

Here's an idea: you actually express an opinion first, and then wait for a challenge

I am going out on an argumentative limb purposefully - for validation and review of my thoughts

Which thoughts?

I ask in all sincerity

In light of you having yet to describe ONE 'non-legacy, rich, online experience' let alone any protocols, applications, interfaces and/or platforms, it seems (to me) that your thoughts on this subject are not quite fully formed

Please, feel free to prove me wrong

Remarks about beating my wife or bishop are not really helpful though

Time to build a bridge?
 
Hi again,
So I'm learning html and CSS from a great book I bought from Amazon and from web tutorials like w3cschool and htmldog.com. Now I think I have the basic knowledge (although not the experience) in order to proceed further.
Which web language do I need to be using in order to incorporate if..then statements, for...end loops, play an mp3 as soon as the website loads and stuff like that?
Thanks,
Yair
 
Which web language do I need to be using in order to incorporate if..then statements, for...end loops,

That depends on what you want to use those controls for. If you want to influence the appearance of the website (like, see your name written 500 times) have a look at PHP and whatever else has been suggested in the thread alongside with it.

play an mp3 as soon as the website loads
You do not want to do that. Really, you don't.

But if someone ever holds a gun to your head and demands this or some similar atrocity, you might want to have a look at JavaScript and its events. (There may be a HTML way of incorporating media with the object-tag or some such thing for mp3's specifically, but I honestly don't know.)
 
Which web language do I need to be using in order to incorporate if..then statements, for...end loops,
Javascript, which you'll have to cram into the HTML documents between script tags. Yes, it is true. Designing webpages means you'll have to combine several ridiculous languages, each with their own idiotic verbose syntaxes and inconsistencies.

play an mp3 as soon as the website loads and stuff like that?
Don't do evil...
 
he he...I'm getting a signal from somewhere telling me I shouldn't play an mp3 with my site. I'll tell you what I am aiming at. I want to build a website for a home recording studio that I'm building. Nothing fancy (the studio I mean) so the site is not business oriented. I just want to grab the attention of the visitor by playing a tune I recorded in my studio. He will have the option of turning the music off if he wishes.

Now regarding the if..then statements. I want the appearance of the site to change according to the hour of day as it appears in the computer clock. let's say night time (8pm - 5am) dark with stars, (6am - 8am) dawn, etc. Can this be done?
what if different people visit my site at different times of the day from other countries? Would that be difficult to implement?

Thanks,
Yair
 
Another vote for javascript, which is both a client-side and server-side language (unlike PHP)

Client-side and Server-side JavaScript
(Page 1 of 6 )

This article explains the three major types of JavaScript, client-side, server-side and the core language. Server-side JavaScript is ideal for creating web applications that can be run on any platform, on any browser, and in any language. See the article for other advantages and disadvantages of each.

And another vote re saying NO to mp3s
 
he he...I'm getting a signal from somewhere telling me I shouldn't play an mp3 with my site. I'll tell you what I am aiming at. I want to build a website for a home recording studio that I'm building. Nothing fancy (the studio I mean) so the site is not business oriented. I just want to grab the attention of the visitor by playing a tune I recorded in my studio. He will have the option of turning the music off if he wishes.

Maybe we should have put the message into an mp3 and played it to you upon loading this page. But since you apparently won't listen to hints, here's the gist of the argument:

This is my computer. I tell it what to do, how to do it, and when to do it. That means the computer will play the music (or sounds) that I tell it to play, when I tell it to play them. (with my choice of volume, format and application thrown into the mix for good measure.)

If I want a web page to play sound because it offers me to do that, I'll let the site know what I want.

The same is true for my attention, btw. At any one time, I've between 1 and 30 websites open in usually less than three windows. I guess between 5 and 10 sites is a good average. Most of these will be opened in tabs for later reading, when I no longer wish to direct my attention at the current site.

Sites that think they can supersede my choices get clicked away fairly quickly. (Unless they are incredibly important to me. Most sites aren't. I am literally one of the chosen few who Google asked what to include in that search engine thing they have going. Trust me, whatever your site may have to offer, I'll be able to find somewhere else.)

And all that isn't even going into the individual reasons I might have for not wanting a random website to hijack my computer at any given time.

Right now I have poker game running, e.g. and I need to hear what it's doing whilst typing. (Bad style, I know, but there you go...) I might be at work, or in a library, too. I could be on a slow connection (it happens) and might not want to waste bandwidth on music.
 
I want the appearance of the site to change according to the hour of day as it appears in the computer clock. let's say night time (8pm - 5am) dark with stars, (6am - 8am) dawn, etc. Can this be done?
what if different people visit my site at different times of the day from other countries? Would that be difficult to implement?

Yes

and No

Mostly No

The time on a visitors ('local machine') clock won't, alone, tell you how dark it is... you'll need their latitude too

e.g. Helsinki and Johannesburg are in the same time-zone but half-a-year apart re the seasons

'Sniffing' for geo-locations is an art, not a science... and it can get v messy, v quickly

Unless such functionality is an absolute MUST HAVE, I'd forget about it until you have a much firmer grasp of ALL facets of web-design and implementation
 
six7s, let's forget about sniffing how dark it is outside. I want my site's appearance to have a background image of night time with stars between 8pm and 5am showing on the local machine clock. Doesn't matter if 8pm here is not as dark as 8pm somewhere else. How difficult will it be now to implement?
 
Rasmus, I see your point.
I still see a good point in my original idea also but I'll definately think about it.

Now about that changing background appearance...

The logic is very simple: if clock="range of values" then background-image: url(some background image that I choose).
No?
 
Now about that changing background appearance...

The logic is very simple: if clock="range of values" then background-image: url(some background image that I choose).
No?

Yes. JavaScript should allow you to do that fairly easily.

Make sure it degrades gracefully (i.e. there will be a default background, e.g.) and that the page looks good on all backgrounds - or even without one.
 
I just want to grab the attention of the visitor by playing a tune I recorded in my studio. He will have the option of turning the music off if he wishes.
No one is saying that you shouldn't have a little player on your site, but for the love of God don't make it play when the site loads, especially if it is "attention grabbing" music. You'll have to remember that MP3 tend to be rather big, and therefore take some time to load. Your visitors will enter your site in silence, continue to go their merry way reading some of the stuff you put up there and only then will the music start, scaring the bejesus out of them. You won't notice this when you design the site on your own computer, as the music will locally load almost instantly.

If you honestly have to put background music on your site, make sure it is something suitable for the background. Make sure it fades in slowly so the user is not confronted with a wall of sound he wasn't expecting, make sure it fades out neatly so it doesn't make an abrupt stop before repeating itself and make sure it isn't loud, fast or in any other way annoying. I think it can be done tastefully, but you'll probably be the first to try.

Now regarding the if..then statements. I want the appearance of the site to change according to the hour of day as it appears in the computer clock. let's say night time (8pm - 5am) dark with stars, (6am - 8am) dawn, etc. Can this be done?
what if different people visit my site at different times of the day from other countries? Would that be difficult to implement?
Yes, it can be done. You'll have to realise though that it means you'll have to design your site several times. If you use server side scripting you can be sure that it is compatible for most people, but your site will probably follow the internal clock of the server. If you use client side scripting, the script will run on the user's computer and therefore will follow the user's computer internal clock. You may be able to use a server side script that guesses the user's location and adjusts the page to the timezone, but that requires a lot more experience in programming and there is good chance that the script will guess wrongly.
 
Last edited:
Earthborn said:
You may be able to use a server side script that guesses the user's location and adjusts the page to the timezone, but that requires a lot more experience in programming and there is good chance that the script will guess wrongly.
hmmm, I guess I was not very clear in my explanation before.
I want my site to look at the local time of the user's computer wherever he may be. If some user's clock shows some time (say 8pm) then one background image loads up. But at the same time a person in another part of the world has a totally different time (say 1pm) then for that user the background image will be different. Can a web site show 2 different backgrounds for two different users at the same time?
 
Can a web site show 2 different backgrounds for two different users at the same time?

Yes, or rather a web server can deliver pages dynamically (in response to client-side requests and/or settings)

But... please note the point made by Rasmus, my web browsers (plural) are mine, and I have twiddled with them to the point where they each have their own idiosyncracies with regard to handling content

I have client-side scripting turned off by default*

And I enable caching, so that I don't have to download the same content over and over again

These two factors alone will cause you headaches trying to show me a time-dependent image

Oh, and I often turn images off completely

And, sometimes, I turn off CSS too

Good luck :)

------------------
* if a site doesn't display well (WITH meaningful text inside <noscript> tags), then (unless the site offers something I really want and can't get elsewhere) I'm v v v likely to close the tab v v v quickly
 
Last edited:
I want my site to look at the local time of the user's computer wherever he may be. If some user's clock shows some time (say 8pm) then one background image loads up. But at the same time a person in another part of the world has a totally different time (say 1pm) then for that user the background image will be different. Can a web site show 2 different backgrounds for two different users at the same time?
I understood that. I was just pointing out how different techniques influence on what you can do. The easiest to do what you want is by clientside scripting, that is running a little program in the user's own browser.

Here is a small HTML code with Javascript in it that displays an image called "night.gif" between 18.00 and 6.00, and another called "day.gif" between 6.00 and 18.00:
Code:
<html><body>

<SCRIPT LANGUAGE="JavaScript">
    <!-- Hide this code from non JavaScript browsers
    currentTime = new Date();
    if (currentTime.getHours() < 6)
	document.write("<img src='night.gif' alt=''></img>");
    else if (currentTime.getHours() < 18)
	document.write("<img src='day.gif' alt=''></img>");
    else
	document.write("<img src='night.gif' alt=''></img>");
    // End of JavaScript code -->
</SCRIPT>
<noscript>
<img src="neutral.gif" alt=""></img>
</noscript>

</body><html>
I adapted it from an example script found here, and I also added an extra bit so it displays a picture called "neutral.gif" if the user's browser doesn't support Javascript. All you need now are a couple of pictures. Make sure they are the same size! You can use JPG files too of course, but you'll have to change the names that appear in the script.

Also make sure the names in the script have the same case as the filenames you use. Windows isn't case sensitive, but webservers generally are, which means that if you refer to a picture as "day.gif" and the file is actually named "Day.gif", it won't show. A good idea is to only use lowercase letters for any file you intend to put on the web, it will save you a whole lot of hassle.
 
hmmm, I guess I was not very clear in my explanation before.
I want my site to look at the local time of the user's computer wherever he may be. If some user's clock shows some time (say 8pm) then one background image loads up. But at the same time a person in another part of the world has a totally different time (say 1pm) then for that user the background image will be different. Can a web site show 2 different backgrounds for two different users at the same time?
Yes.

With client side scripting the code runs on the end users computer and it knows the users own local time. In client side scripting it may be hard to know the time at the server. The opposite is true for server side scripting. On the server it's easier to know the server's local time and harder to know the user's (user meaning the person viewing the web site).

BTW don't know if someone mentioned this but, unless you own/control the web server, you're very likely to be restricted to client side scripting.
 
Here is a small HTML code with Javascript in it that displays an image called "night.gif" between 18.00 and 6.00, and another called "day.gif" between 6.00 and 18.00:

As an advocate of HTML4.01 strict, I nest inline elements (e.g IMGs) within block-level elements (e.g Ps, DIVs, H1s etc) and IMG tags are self-closing

The script can (should?) be in the head section, and called from within the body (or, even better in terms of bandwidth and maintainability, saved as a .js 'library' file and imported into multiple html files)

Oh, and by 'declaring' the variable within a function (var currentTime = new Date();), it is local (otherwise, it would be global... a potential cause of bugs)

What follows uses the same three IMG files and is valid according to the w3C local html file validator and my favourite javascript editor/validator, which ignores <SCRIPT LANGUAGE="JavaScript">, looking instead for <script type="text/javascript">


HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
"http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>time based image script</title>
		<script type="text/javascript">
			<!-- HIDE THIS CODE FROM NON JAVASCRIPT BROWSERS
			function displayImage()
				{
					var currentTime = new Date();
					
					if (currentTime.getHours() < 6)
						{
							document.write("<p><img src='images/night.gif' alt='Night'><\/p>");
						}
					else if (currentTime.getHours() < 18)
						{
							document.write("<p><img src='images/day.gif' alt='Day'><\/p>");
						}
					else
						{
							document.write("<p><img src='images/night.gif' alt='Night'><\/p>");
						}
				}
			// END OF JAVASCRIPT CODE -->
		</script>
	</head>
	<body>
		<h1>
			TIME BASED IMAGE SCRIPT
		</h1>
		<script type="text/javascript">
			<!-- HIDE THIS CODE FROM NON JAVASCRIPT BROWSERS
			displayImage();
			// END OF JAVASCRIPT CODE -->
		</script>
		<noscript>
			<p>
				<img src="images/neutral.gif" alt="no image">
			</p>
		</noscript>
	</body>
</html>
 
six7s said:
Oh, and I often turn images off completely

And, sometimes, I turn off CSS too
I don't think you would qualify as the "average web surfer".

Thanks Rasmus, Earthborn, six7s, RecoveryYuppy for your help.
I'll need to sink my teeth in Javascripts to know what you guys are talking about with the code you provided above. I'll do that. It's nice to know I can count on you guys to help a newbie out.
 
I don't think you would qualify as the "average web surfer"

<crystalball>
Maybe not now... but... when surfing via mobile phones takes off, images-off-by-default may well become the default setting for many if not most surfers​
</crystalball>
 

Back
Top Bottom