I want a script for Javascript where I want to display a particular record when a particular button will be clicked.
So, here is my requirement:
Here is a particular record where it governs through a 3 stage workflow process(Submit to assessor,reviewer and practice auditor). In this record there are 50 questions and when the user completes the assessment by attempting all 50 questions he'll click save and review button which is present by default at the bottom of the page.
So, i want when the user clicks the Save and Review button, after that an automatically the "Submit to reviewer" button will appear. Same operation I want to perform for assessor and practice auditor.
Can anyone please explain the script which I've to write to accomplish this scenario?
You just need to hide the button you wish to show, and reappear it when needed like this:
if(document.getElementById("element").click()){
document.getElementById("elemenet2").style.visibility = "visible";
}
This is the easiest way using pure java script.
Related
I looked on SO, here, a few other places & ... cluelessness set's in.
What is the structure of the Facebook " Like " Button found all over websites ?
Is it a Social Bookmarking, Browser Button kind ?
Is there a step by step process (without using FB Api) to make my own kind of button.
How to design & implement a Like Button ?
I want my own button with similar functionality as FB but NOT related or developed on their platform! I am trying to input this in iWeb'09 as a html widget.
I've done this successfully. Here's how i did it:
You have a table in a database called "likes" with fields username,postid (and date, id if you want too)
Each post/blog/article should have its own id.
When someone likes a post/blog/article, you take the id of the post/blog/article and the username who liked it and check the likes database to see if it already exists. If it already exists, you remove the like. If it does not exist you add a like.
For example with AJAX, this is how i did it specifically:
I have a blog post with id 6.
Jonathan likes this post.
These 2 variables are sent via a post form and wait for a response, likes logic checks database to see if this record already exists in likes table (username,postid) values ('Jonathan', 6) if the response is 1 (or true), then i update the div number for the likes button from whatever value was there originally and add 1. If the response is 0 (or false) then i take the original value in the likes counter and remove 1.
To answer your question consider what happens with buttons and then go into like buttons.
Pressing a button triggers an event on client which may or may not update a server somewhere to notify that a button has been pressed for such and such intention. You can send a lot of extra info with this event like when and where who and why etc
Like buttons usually have extra info on who liked it and what they like. In order to get that you might ask people to sign in or provide some kind of input to identify them.
Take a real world example of a like button you can implement in say javascript using any server side technology
Whoever install your script will be able to see the button. You may form it with any css or your javascript can simply load an iFrame from your server or append elements to DOM to show this button
When clicked it calls your server with person's info or at least the page url where it was called. For example google analytics uses a unique ID associated with domain url to track visitors.
when you recieve this call you can update your database/storage or anything with the tick mark that button on abc site has been pressed so lets update their likes or dislikes.
If you want your javascript can also increment the number on the same page either before or after updating your server.
When someone else visit that site the script again loads and send a request to your server so you can update the count on page but this time user does not click on like/dislike button so you dont update the record.
You may then show it as a pie chart to user on total visits to their site or page with division in people who liked it and people who did not report back (did not press the button)
If you are still wondering how you can create a button . Use CSS button generator to get one
You must first have a database where you can store various values.
Now, Whenever the user clicks the button, the value of the button stored in the database must be incremented. For this, you will need a backend language which connects you to SQL database.
So whenever the button has clicked the value of the likes in the database changes.
So I have 3 forms all on one page, and I have buttons on all those forms to go show or hide previous/next forms. However the back button just takes you to the previous page entirely. Is there a way to have the back button to check if there is a previously completed form and go to that form?
Sorry for the open ended question but I'm at a loss.
Using a database to save your previous walk, will be better trying to,manipulate hiding button using styles and JavaScript will get you in cache mess someday ,,
Please paste your code here for we can see wat u have done,,
I have been working on buttons for an questionnaire, which consists of 5 questions. The questions ask about something on a scale of 10 using
I want to print different messages and apply HTML only for certain cases.
1) Let's say the user leaves all questions in the questionnaire blank, and clicks on "Skip" button. This will just direct the user to the next page.
2) If the user answers to some of the questions and clicks on "skip," then I want to print a message asking if the user wants to move on to the next page without submitting the answers. If Yes, it just directs the user to the next page, but if no, I want the user to continue filling up the questionnaire.
Right now I have buttons "Skip" and "Submit" using and it contains "onclick = "location.href='nextPageExample.html'"> But this will ALWAYS happen, but I need to move the user to the next page only if the user clicks on "yes" without submitting answers. If the user chooses "no," they need to stay on the questionnaire page.
In a nutshell, I have two questions.
1) How can I check if some questions are left blank? I tried id="example" and tried
if(document.getElementById("example").checkValidity){
window.alert("THANKS");
}else{
return false;
}
but this did not work. It only prints THANKS even when I didn't fill out the question, and sends me to the next page anyway...
2) How can I apply HTML "onclick=location.href='example.html'" only if all the questions are answered?
Why don't you use a combination of jquery + jquery validation? This should be quite easy. Every page contains a form, you attach the validate handler to it, and if it validates, then set window.location.href="next_page.html"; Otherwise, jquery validation will catch the error. You can even write custom validation functions.
Without seeing your code, it'll be hard for anyone to show you what to write.
I want to build an interactive page within a website. On this page i want to put a list of items, that people can choose from, in order to bring one of them to a certain event/party.
Once a user choses an item via a confirm pop up box, i want the button to be ultimately disabled, even if the user opens the page again or another user opens the page.
I want this event to happen within a conditional statement in JavaScript somewhat like this:
if (confirm("Do you really want to bring this item to the event/party?") == true) {
HERE I WANT TO PUT THE CODE THAT IS NECESSARY!
} else {
}
I don't think you can do this with pure JavaScript, because JavaScripts loads everytime the page gets refreshed. Are you getting your data from a database? If so, you could add another field to your table e.g. "party" with the name "active". If the user clicks on a button, the party would be inactive and not showing up anymore.
But as I said, I think it's not possible with only JavaScript.
PS: Greetings from Germany ;)
You can't do this with JavaScript alone. You will need to employ some server-side scripting and (ideally) a database to store who has selected what so that you can "prevent" someone else from selecting the same item.
Your system should also include a user registration process so that you can tie your products to events and then tie users to the products they have selected for the event.
Thus:
User registers -> they select an event -> they select a currently available product -> some confirmation occurs which then flags the database that anyone else is unable to select this product for the chosen event. The confirmation can be achieved with standard forms processing methods or AJAX...
Once a user choses an item via a confirm pop up box, i want the button to be ultimately disabled, even if the user opens the page again or another user opens the page.
Javascript can't preserve these types of states. It only runs in users browsers. You can't save it to cookie either. Saved cookie is only useful for certain users certain browser. You have to save this data in your server (preferably in database) from where you can read this item is chose by a user. And then you can decide from client when to disable the button.
Hi i want a button to be shown on all my pages.
that code should be in such a way that no form filling is needed
the text on button will be "Problem? Click Here"
when click on button, it will be pressed and the person who has clicked cannot click again unless reload the page.
After the button is clicked the mail should be sent to admin with the exact link of page where button was clicked.
there should be no form to fill.
As for example facebook like button like the content meanwhile its pressed.
What should be the code for this? Any suggestion please?
Thank you
You can use an HTML button element with an onclick javascript function linked to it.
Since you don't want the button to work again until you have reloaded the page, you will need to do this through AJAX. This means you will have to send a request to the server, where, for instance, a PHP script will retrieve the page name from a GET variable and send the email to the administrator. The javascript part can keep track of the button being clicked once or not.
That should give you some pointers on where to start with your code. However, as stated in direct comments to your question, this site is not meant for asking for coding work to be done for you. Perhaps next time, try to think of a possible solution and ask for advice on your solution (improvements, coding conventions, etc)