i'm trying to make like button now i'm stuck i can't make that you can like just once ! and make it save for example liked 10 likes save to 10 like when refreshing

<html>
<head>
<title>blah</title>
<script language="javascript">
function addone(field) {
field.value = Number(field.value) + 1;
}
</script>
</head>
<body>
<form name="myform">
<!--input type="submit" onclick="this.disabled = true" value="Save" -->
<input type="text" name="myfield" value="0" size="5" readonly="readonly"><br>
<input type="button" value="Like " onclick="addone(myfield);" onclick="this.disabled = true">

</form>
</body>
</html>
basil khatibAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Tom BeckCommented:
<input type="button" value="Like " onclick="addone(this);">
<script>
function addone(field) {
      field.value = Number(field.value) + 1;
      field.disabled = true;
}
</script>

Open in new window

Didn't understand the second half "10 likes save to 10 like" ?? But maybe instead of this:

field.value = Number(field.value) + 1

...you want this:

field.value = Number(parseInt(field.value) + 1);

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
basil khatibAuthor Commented:
No I need That the user can like only once !
and lets say i have got 12 likes i need to save that i have 12 likes like
Tom BeckCommented:
field.value = Number(parseInt(field.value) + 1);

Did that work?

Thanks for the points.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

basil khatibAuthor Commented:
NO :/
When I'm make likes i can make 1000 at once i need to make just one no more
and
i need to save that number of likes
it's The same thing :/
Tom BeckCommented:
Do you still need help? You closed the question so I'm confused.

Can you tell me where the function called Number() is? Is that part of some Facebook API that I don't know about?

Do you have the special Facebook "Like Button" html markup on your page? (look here). When a visitor clicks the "Like" button it increases your likes by one on Facebook and the number displayed on your page reflects the change. That's how it's usually done so I'm confused by what you are trying to do with your addone() script.
basil khatibAuthor Commented:
i'm new to the site so by mistake :(
no until now i stil have the same problem
Tom BeckCommented:
Can you answer my questions about the Number() function? About the Facebook "Like" markup? About the addone() script?
basil khatibAuthor Commented:
No I dont have it
Tom BeckCommented:
Are you trying to create your own "Like" button, completely separate from Facebook?

The following example will let the user click the button one time to increase the count from 10 to 11. However, to keep a running count that every visitor can see you need some kind of server side technology to store the number of likes so you can add that to the page as a starting point. PHP and a MySql database would be one way to store the number on the server.
<!DOCTYPE html>
<html>
<head>
<title>blah</title>
<script language="javascript">
function addone(fld, but) {
	var field = document.getElementById(fld);
    field.value = parseInt(field.value) + 1;
	but.disabled = true;
}
</script>
</head>
<body>
<form name="myform">
<!--input type="submit" onclick="this.disabled = true" value="Save" -->
<input type="text" id="myField" name="myfield" value="10" size="5" readonly="readonly"><br>
<input type="button" value="Like" id="myButton" onclick="addone('myField', this);" /> 

</form>
</body>
</html>

Open in new window

Does this help?

If you want a "Like" button that connects with Facebook, you have to get the Facebook markup and paste it to your page. Facebook will keep the count for you.
basil khatibAuthor Commented:
Yes A lot thx
yeah I know ... thx a lot :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.