Search the Blog

Monday, August 5, 2019

JavaScript window.prompt() program logic code and syntax with demo example

If we want to get an input before proceeding then we should use window prompt.

Suppose we want to check whether the user is 18+ or not.

Basic Syntax  :-
prompt(text, [default]);

text: The text displayed in the prompt box. 

default: A default value for the input field (optional).

Examples var age = prompt("Are you 18+ ?");

console.log(age);

// Prints the value inserted by the user
JavaScript window.prompt() program logic code and syntax with demo example

We have two button one is ok and second is cancel, if we select ok then entered value will be returned or null.

While the prompt box is displayed, the user is prevented from accessing other parts of the page, since dialog boxes are modal window.

Javascript window.alert() concept code and syntax with demo example

The Window alert method displays a visual alert box on screen.
This method parameter is displayed to the user in plain text:

Syntax 1- window.alert(message)

Syntax 2- alert(message)

Note:- Window is global object.

Code:-window.alert("Do you want real to send request?");

Output:-

Note:- Alert method is technically a property of window. so that's why it becomes a global object and we can use this any window.


 Alert always acts as a modal prompt that means the code calling alert
 will pause/hold until the prompt is not answered . that means no other JavaScript
code will execute until the alert is dismissed:

JavaScript Code to hold the Display-
  alert('Pause!');
 console.log('Alert was dismissed');


Rad only access to new user Sql Server 2017 step by step

when we require to prevent the access to a user for specific tables
Following steps we help to understand  the concept


Step 1:-
     Login to SQL Server - SSMS via admin rights


Step 2:- Object explorer in Right hand side  and click on security



Step 3:- Right click on security, Then click on new Login

Step 4:- Create Login Name and Select Sql Authentication, Set password, Select database

Step 5 :- Select Server Rule and select access as public

Step 6:-  Select User mapping
Step 7:- Select
Step -8:- Select access grant
Step 9:- Grant permission via query
Step 10:- Close your SQL Server Management Studio SSMS and again login.
          New user will have the access rights of only one table and has only read only rights


Translate