need the text to go away when clicked
This is a discussion on need the text to go away when clicked within the Graphic Design and Web Design Help, part of the General category; This is a really simple inline function. To place this anywhere else, especially in a separate file all on it's own, would be require ten times more code and increase the server request load. ...
-
Design Guru
This is a really simple inline function. To place this anywhere else, especially in a separate file all on it's own, would be require ten times more code and increase the server request load. Not by a significant amount it's true but nevertheless; I can't think of any good argument for not using simple inline functions like this when it makes sense to do so.
-
Mr. Tambourine Man
What's the better way to do it then if that's deprecated?
-
CSS Wizardry
Haha Eoin you know I know nothing about JS but I read it's best to let JS do all the work and leave markup untouched. I'm saying now I could be wrong but that means that the source I got it from is also wrong.
-
Experienced Member
-
CSS Wizardry
-
Mr. Tambourine Man
JS libraries. Bah! Hogwash!
-
norks!
I just needed a very simple solution for a website that will be live for about 3 weeks.
Arkady you have hit the nail on the head mate, thank you very much :D
Soon to be here:
holeycoww designs
-
Design Guru

Originally Posted by
...Gav
I just needed a very simple solution for a website that will be live for about 3 weeks.
Arkady you have hit the nail on the head mate, thank you very much :D
My Pleasure.
-
likes chips.
The only realistic way of doing this is the way that Arkady has demonstrated. Microsoft has not implemented the W3C's event handling model, i.e., addEventListener(event, function, state); instead they implemented their own attachEvent which is pretty useless for doing anything with data from the object it is attached to.
You could of course do:
Code:
document.getElementById("foo").onclick = function(){
if(this.value == "Your name here") this.value = "";
};
but this needs to be placed after the element it is attached to in the code. This can be remedied by attaching the event after the page is loaded:
Code:
onload = function(){
document.getElementById("foo").onclick = function(){
if(this.value == "Your name here") this.value = "";
};
};
This can get messy if you need to do numerous things at page load so you're probably going to want to create an event stacking function. It may look prettier in the markup but the Javascript is going to be awful.
I'm not sure it's worth it.
-
Design Guru
^^^ My point almost exactly. Why replace a simple in-line statement with a mass of tangled code behind statements just because the trendies want total separation in all circumstances. It strikes me that there is a certain amount of coding fascism when it comes to these kinds of subjects. You do what works best, is the most readable and is the most economical in terms of available resources.
Similar Threads
-
By KyleOpium in forum Graphic Design & Web Design Critique
Replies: 5
Last Post: 09-02-2009, 10:17 AM
-
By a3dy in forum Design and Print Software
Replies: 1
Last Post: 10-03-2008, 01:47 PM
-
By katie roos in forum General Web Design Forum
Replies: 0
Last Post: 28-01-2008, 03:05 PM
-
By Toon in forum Off Topic
Replies: 4
Last Post: 24-01-2008, 07:12 AM
-
By Dinx in forum Graphic Design and Web Design Help
Replies: 6
Last Post: 07-12-2007, 11:42 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
Check the forum often for the latest design announcements. Everything from graphic design and web design, to films and music.
Estetica is a great place for people to get together and help each other out.
Web Hosting - UK Web Hosting services for business or personal website hosting needs.
Dedicated Servers - A full range of Managed Dedicated Server solutions suitable for all your requirements.
Online Backup – Backup Technology offers competitive online backup, disaster recovery and business continuity.
Web Design UK | Vision.To Design | Leaflet Printing | Estetica Design Forum's Privacy Policy | Pocono Web | Flyer Printing | Photography Blog | Graphic Design Links
Graphic Design Social Network | Logo Design | Brochure Printing | Land for sale | Leaflet Printing | CNC Precision Engineering | Graphic Design Blog
Custom Logo Design - $149 Only | Affordable Print Design Templates | Small Business Logo Design | Company Logo Design
Logo Design Service | Logo Design Firm | Logo Design Reseller | Custom Logo Design | Letterhead Printing | Flyer Printing | Business Card Printing
Online Backup | T-Shirt Printing | Personalised Mugs | Canvas Printing | Tradeshow Ideas
Bookmarks