JavaScript display variable in alert

Ads
 

JavaScript display variable in alert

How to display variable in alert box? I am using javascript.

View Answers

May 16, 2012 at 4:31 PM

<html>
<head>
<script type="text/javascript">
function showAlert() {
    var name = "Roseindia";
    var city = "Delhi";
    alert(name +" is in "+ city);
}
</script>
</head>
<body>
<input type="button" value="Click for Alert" onClick="showAlert();">
</body>
</html>

Description: In JavaScript variable is declared by using var keyword.This variable can hold any type of value as int,string,float etc.alert() is used to generate alert. You can put variable or any statement in alert which you want to display.

Ads









Related Tutorials/Questions & Answers:
JavaScript display variable in alert
JavaScript display variable in alert  How to display variable in alert box? I am using javascript.   <html> <head> <script... put variable or any statement in alert which you want to display
JSP Variable in Javascript
JSP Variable in Javascript          JSP Variable in Javascript helps you to pass jsp variable to javascript. The JavaScript include a function
Advertisements
Javascript alert message
Javascript alert message   How to send an alert message to a user in JavaScript
javascript prompt alert
javascript prompt alert   Sending a prompt alert using a JavaScript function
javascript statement alert
javascript statement alert  JavaScript Alert If Statement   JavaScript Alert if Statement <script type="text/javascript"> <...;/script> JavaScript Alert else if Statement <script type="text/javascript
JavaScript Alert YES NO
JavaScript Alert YES NO  How to send an alert to a user to confirm if there request is valid or not? I wants to send the alert message in Java Script... type="text/javascript"> function show_alert(my_string) { alert(my_string
how to assign javascript variable value to a jsp variable
how to assign javascript variable value to a jsp variable  how to assign javascript variable value to a jsp variable
Passing a java property to a javascript variable
/javascript"); %> var collegename = ''; Java Script code: alert("collegename...Passing a java property to a javascript variable  i want to assign a java property to a js variable: action class: collegename have a property
how to call the array variable in scriptlet from javascript function
how to call the array variable in scriptlet from javascript function  ...","Porsche","Jaguar"}; %> Actually i want the array variable one by one and display them in the dropdown list by using the below function function myFunction
Getting Json data from servlet to javascript variable
Getting Json data from servlet to javascript variable  How do i get json data from my servlet on to a variable in javascript n bind the data to display onto sigma grid.Has anyone Idea how to do
How to pass javascript variable in Scriplet of JSP?
How to pass javascript variable in Scriplet of JSP?  How can I assign the value of a javascript variable to a variable declared in jsp scriplet? Is it possible
. Display JavaScript dropdown selected value
. Display JavaScript dropdown selected value  How to get the selected value from dropdown box? I am using javascript.   <html> <... you select any value from list, alert will display that. In var
How to Display an alert message when nothing is selected in jspinner in java?
How to Display an alert message when nothing is selected in jspinner in java?  Hello, i'm trying to code a jspinner in java and i want to display... with the initial value = 0 what i want is if the user did not select the jspinner an alert
alert
alert  after pressing ok button in alert message it has to stop...; if(username==""){ alert("Enter Username!"); return false; } if(password==""){ alert("Enter Password!"); return false; } return true; } </script> <
Html form using JavaScript to display the table content
Html form using JavaScript to display the table content  HI There, Greetings, I am new to this java and I need your assistance. I have created... want to write a Html JavaScript coding to display the content from database
unable to get value returned from javascript variable in page
unable to get value returned from javascript variable in page  Hi, I... and store it in a variable so that i can use it in my servlet to validate an if else... the value of the radio button from fisrt page to be stored in a variable so
javascript
javascript  write a program to display implement about browsers using javascript
Java Alert Box
JOptionPane class to display the message alert box.  JOptionPane class is available...Java Alert Box In this example we will describe java alert box. First of all we have created class than main method after that we have created alert box
Javascript
Javascript   Javascript to check Numeric entry in checkbox.....  ... in javascript function validateBox(){ var data=document.myForm.someText.value; if(data=="" || data==null){ alert("Please Input Data
jQuery Hello World alert
display "Hello World" alert box using jQuery. This application will use the JavaScript alert() method to display the "Hello World" message... braces{}. In the curly braces we have defined the JavaScript alert() method
javascript
javascript  hi, I was actually working on to calculate the number of days between two dates of yyyy-mm-dd format using javascript, and when i click on button then number of days should be display in textbox
Javascript
this format xxx-xxx-xxxx, i want the code in javascript. as a function.   Javascript Phone Number Validation <html> <script> function...)-(\d\d\d)-(\d\d\d\d)/; if(ph==""){ alert("Enter Phone Number!"); } else
unable to display image using html tag in servlet.(image src is in a variable.....). i am using netbeans IDE. plz..........do help
unable to display image using html tag in servlet.(image src is in a variable.....). i am using netbeans IDE. plz..........do help  import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException
jQuery alert()
box can display information. This example displays an alert box after clicking...jQuery alert() In this jQuery tutorial we will discuss how an alert box works in jQuery. Moreover, this tutorial will discuss in details about alert box
javascript query
javascript query  how to get javascript variable value into java variable?? i have one value in javascript variable(var name = value ) i want this name variable value in java variable (string name1
display
display  please tell me how to display the content from database.. if we click on any image using servlets/jsp...please
JSP Alert
JSP Alert          JSP Alert is used to put the validation on login... the validation on the login form using Javascript method in JSP page.  Understand
alert for validation
alert for validation  i want to put alert on the text box that enter data should be in DD/MM/YYYY format only through javascript validation.    <html> <script type='text/javascript'> var
Javascript
/javascript"> function validateForm() { var sname=document.getElementById('spocname...<10){ alert('enter min 10 characters'); sname.focus(); } if(scontact.value.length>10){ alert('enter less than 10 characters'); scontact.focus
JavaScript
JavaScript  clone JavaScript
Local Variable and Instant Variable
Local Variable and Instant Variable  difference between Local Variable and Instant Variable   Difference between local variable and instance variable Instance variable is declared within a class but not within

Ads