This question already has answers here:
Custom alert using Javascript
(6 answers)
Closed 7 years ago.
In a static html page i want to do following actions:
as the url is entered first I want to display the terms and conditions using window.alert("TERMS AND CONDITIONS").
In the dialogue box I want two buttons "agree" and "dont agree". If agree is pressed I want to use window.location.assign("next page url") .And if dis agree is pressed I want to use window.close("","_self")
I'm a total beginner and have minimum knowledge of Javascript.
Thank you in advance.
You can not modifiy the default alert dialog.
But instead, you can use one of the many Dialogs made for jquery and other libraries.
http://www.sitepoint.com/14-jquery-modal-dialog-boxes/
The alert box is a system object, and not subject to CSS. The jQuery UI Modal box does a lot of the work for you Link.
if you want a basic browser graphic u can use
window.confirm("TERM AND CONDITIONS");
that return true or false based on action. For more advaced usage check jquery dialogs boxes (docs https://jqueryui.com/dialog/ ) or bootstrap (docs http://nakupanda.github.io/bootstrap3-dialog/)
Related
This question already has answers here:
How to advance to the next form input when the current input has a value?
(10 answers)
Closed 6 years ago.
I have a user interface created in HTML and working with Angular. I want to set one of the buttons from a numeric keyboard to behave like the Tab button. I want user to be able to switch fields in the interface using one of the buttons from a numeric keyboard.
Not possible - this article (http://www.howtocreate.co.uk/tutorials/javascript/domevents) explains (for security reasons) why your script can't simulate actual user interaction. You're going to have to simulate the "tab"s behavior instead (i.e focus in another field, etc.)
This question already has answers here:
How to edit a JavaScript alert box title?
(10 answers)
Closed 6 years ago.
When using the confirm dialog box in Javascript, the first line is "<URL name> says:" then it is followed by the string specified in the js call.
Is there a way to change that first line?
The confirm box, just like the alert box, is a system object, and not subject to CSS. To do this style of thing you would need to create an HTML element and mimic the confirm() functionality.
What you want is not possible, the url in the confirm window is not customizable. As a solution you could create your own modal box and style it as desired.
This question already has answers here:
How to style the browser's autocomplete dropdown box?
(2 answers)
Closed 9 years ago.
Defaultly, when you input something to text field, you get suggestions with values you entered before. So my question is, is it possible to use CSS to modify appereance of that suggestion dropdown. Or could you please suggest javascript code to recreate its bahavior?
No, it is browser's native implementation. the browser doesn't even add or modify any new DOM element therefore you can not style the dropdown list. I am not 100% sure but it looks like the drop down list is on a different layer on top of the display page. You will need to have a your own Javascript implementation of autocomplete.
By the way to disable this browser behavior, add this to the input element:
autocomplete="off"
Note that not all browser support autocomplete attribute
You can't fiddle with the native browser's autocomplete box, but you can with custom implementations. I'd wager the most popular is this one: http://jqueryui.com/autocomplete/
I should note that the custom implementation won't serve up values the user has entered before unless you are capturing each term the user is entering, and use that list to populate your autocomplete box.
This question already has answers here:
Changing the default title of confirm() in JavaScript?
(8 answers)
Closed 9 years ago.
I want to add my project title to a javascript confirm dialog, and want to change "Ok" and "Cancel" to "Yes" and "No". How can I do this?
We can't override the functionality of the JS . But you can show your project name on top by using the trick "nextline(/n)" as i did in my project :)
This is just an trail solution for your satisfaction . :)
confirm("ProjectName \n\n\n\n\ some question goes here ");
If you're talking about confirm function in javascript, well, you can't change its properties. I suggest look into using a custom confirm dialog box e.g. jQuery UI's modal confirmation. You have many options out there and by using custom ones you have a lot of things you can do, you can even change colors of the box if you want. Just an idea :)
This question already has answers here:
How to edit a JavaScript alert box title?
(10 answers)
Closed 3 years ago.
How can I change the title message of an alert box in JavaScript?
This can not be done using javascript. But this can be done using jQuery. May be this url can help u.
http://labs.abeautifulsite.net/projects/js/jquery/alerts/demo/
This cannot be done. The title is browser dependent and you have no control over it. On the other hand you could implement your own alert box using divs and customize it as you like. Here's an example using the jquery dialog plugin.
I am pretty sure this is outside of your control and can not be changed
This earlier question has some good suggestions in the answers : how-to-edit-a-javascript-alert-box-title