জাভাস্ক্রিপ্ট প্রম্পট টিউটোরিয়াল (JavaScript Prompt Tutorial in Bangla)

 





জাভাস্ক্রিপ্ট প্রম্পট ব্যবহার করে ইউজারের কাছ থেকে তথ্য নেয়া যায়। ইনপুট বক্সে ইউজার তথ্য দিয়ে Ok দিলে (ইনপুট না দিলেও) true রিটার্ন করবে এবং Cancel দিলে false রিটার্ন করবে।

prompt() ফাংশনে দুটি প্যারামিটার দেয়া যায়। প্রথম প্যারামিটারে আপনি যে মেসেজ ইউজারকে দেখাতে চান সেটা আর দ্বিতীয় প্যারামিটারে ইনপুট বক্সে যদি কোন ডিফল্ট মান দেখাতে চান সেটা। যেমন

01.<head>
02.<script type="text/javascript">
03. 
04.function prompter() {
05.var answer = prompt("What is your favorite site""codestrickz.xyz")
06.if(answer){
07.alert( "Your favorite site is " +  answer + "!");
08.}else{
09.alert("canceled");
10.}
11.}
12. 
13.</script>
14.</head>
15.<body>
16.<input type="button" onclick="prompter()" value="Favorite">
17.</body>


২য় প্যারামিটার যদি ফাকা রাখেন তাহলে কোন ডিফল্ট মান দেখাবেনা।


** Cancel দিলে prompt() মেথড null রিটার্ন করে। এই prompt() এর কাজ বেশি নেই। এর ব্যবহার খুব অল্প।

Post a Comment

Cookie Consent
Little Blog serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the data/wifi internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.