+ All Categories
Home > Documents > Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ......

Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ......

Date post: 30-Dec-2019
Category:
Upload: others
View: 286 times
Download: 67 times
Share this document with a friend
56
Syntax Enable Location External Operator Variable Function Event Statement If Statement Else If Statement While Loop For Loop Comments Array Alert Confirm Prompt Print Redirect Popup Date indexOf getElementById inner | | | | ( Javascr i pt Tut or i al i n Bangl a) ( Javascr i pt Tut or i al i n Bangl a) ( Javascr i pt Tut or i al i n Bangl a) ( Javascr i pt Tut or i al i n Bangl a) : run/execute , execute/run
Transcript
Page 1: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

���������������������������� ������� ������� ������� �������

• ������� Syntax • ������� Enable

• ������� Location

• ������� External

• ������� Operator

• ������� Variable

• ������� Function

• ������� Event

• ������� Statement

• If Statement

• Else If Statement

• While Loop

• For Loop

• Comments • ������� Array

• ������� Alert

• ������� Confirm

• ������� Prompt

• ������� Print

• ������� Redirect

• ������� Popup

• ������� Date

• ������� ���

• ������� ���

• ������� ��� �����

• ������� ��� ��

• ������� ��� ����

• ������� ����

• ������� indexOf

• ������� getElementById

• ������� inner

������� �������� ������� �������� ������� �������� ������� �������� | | | | ������ ������ ������ ������ ( Javascr i pt Tut or i al i n Bangl a)( Javascr i pt Tut or i al i n Bangl a)( Javascr i pt Tut or i al i n Bangl a)( Javascr i pt Tut or i al i n Bangl a)� ��� ��� ��� �� ������������: ������������������������ � �� �� �� � �! � !"#! �$" %&' ��&�। ) �$"� !�� �����*�।������� + �� ,�)- ��). ����� ���$#�� &� /����� �����।

,�)- ��). ����� ���$#�� � 01� +2 �3 45& /��� ��& "�� /����� ) ���$# �� run/execute ��&।,�)- ��). ��&6�7" + ���� �� ��).,���� �� ��). ���$#�� $# �� ���. 4�& ���� �� � ��8�� execute/run +5।�����*� � %8�! �#�&8�

+ � ��8�� ������ ��)� � %�" ��� 9! �:�; � 3�5।

�����*� � ��+�3� �!�� ���$# � � 3�5।

Page 2: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

• ���

• Mouse Trailers ( site /��� � ��5 ���� �:; �!�'!)

• <6.��! ��!#

• Alert ����

• 66�6 �)=�

• HTML Form ��� .'!

• >�). �'�

• � ? �&�

webcoachbd.com � �����5� $#� 6@ �6�! &�� �5 ������� (Javascript) �'�" 6��&!।

�%5 6�A�&:B ) ������� '#�# ���� �$ �6!�� 0&'�) )�� � �CD �� ��!" +&।

������� ����$ � %& '� ������� ����$ � %& '� ������� ����$ � %& '� ������� ����$ � %& '� ( Javascr i pt Synt ax Tut or i al i n Bangl a)( Javascr i pt Synt ax Tut or i al i n Bangl a)( Javascr i pt Synt ax Tut or i al i n Bangl a)( Javascr i pt Synt ax Tut or i al i n Bangl a) � ��� ��� ��� �� ������������: ������������������������ � �� �� �� �

�"!��"!��"!��"!� $#�#E6#!�$#�#E6#!�$#�#E6#!�$#�#E6#!� 8�68�68�68�6 ��F��F��F��F 3�3�3�3� �6!����6!����6!����6!��� ������� � ���� ���� ���� ��� �GH�GH�GH�GH %���!%���!%���!%���! ।।।।

1. script ��$ &�&+�� �� /����� �� �&�I�" +& �3 �6�! ������� &�&+�� ��F!।

2. ��F# ������� ���. � �" +& । 3. Test the script

+,-�� ./� +,-�� ./� +,-�� ./� +,-�� ./� ������� 0��1������� 0��1������� 0��1������� 0��1 ����� %1� 8�6 +2 <script> ��$ &�&+��� ��8�� /����� �� �&�I�" +& �3 ���� ������� &�&+�� ���F। script type �+��& "text/JavaScript" �� ��" +&। �6!��� �� � � � �GH ���F! type �+��& ���� "text/css" ��

���F। 01.<html> 02.<body> 03.<script type="text/JavaScript"> 04.<!-- 05.document.write("Hello World!") 06.//--> 07.</script> 08.</body> 09.</html>

%�'�!:

Page 3: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

Hello world!

document.write:

����� script � �'9 8�6 +2 ���'! � &�&+�� 3�� !�� document.write ।যার ��8�� text, HTML 01&� J��)

� �� 3��। ���� ) ���'! �� �&���" text string &�&+�� ���F 3� "Hello World!" !�� 6����"। � /�����

%��'�" +&।

SYNTAX SYNTAX SYNTAX SYNTAX $� �67$� �67$� �67$� �67:::: �6�� �����*� ���. G� �� ���" 6�&! �3 "document.write(Hello World!)" ) statement � �'9 ���!

������ ! �!)। ���! %"�� statement � �'9 �!��' ��" �����*� ������ ! � %���! �!)। "& �6�! 3�� 0��K �%�L���� +� 1��! "& ��GH &�&+�� ��" 6��!। "& ������ ! &�&+�� ��� ��#�7 3�! ���� �

�)! �#� statement ( �#� document.write statements ) � ��।

������� 9�:� ��� ������� 9�:� ��� ������� 9�:� ��� ������� 9�:� ��� ( JavaScr i pt Enabl e Tut or i al i n Bangl a)( JavaScr i pt Enabl e Tut or i al i n Bangl a)( JavaScr i pt Enabl e Tut or i al i n Bangl a)( JavaScr i pt Enabl e Tut or i al i n Bangl a)� ��� ��� ��� �� ������������: ������������������������ � �� �� �� �

08��� �6!��� ����&� ����& �����*� )-��! M�����,������M, &� 06�� �" �� (active) ��" +�।

������� 0� >?��������� 0� >?��������� 0� >?��������� 0� >?���-� @AB�����-� @AB�����-� @AB�����-� @AB����---- @ 96 ����,D�&@ 96 ����,D�&@ 96 ����,D�&@ 96 ����,D�&:::: Internet Explorer 6/7 �6�! security setting �$� check ��" 6��! �3 �6!�� �����*�� �� �� ��F

��!�। �!� �����*� �� ���� �6�� ���� + �। N %1� Tools menu �" Click ��" +&

O "��6� menu +" Internet Options �!&���! ��" +&

P Internet Options � Security tab Click ��" +&

Q "��6� Custom Level &�!&�!&�!&�! Click �� security settings %&' ��" +&

R Scroll �� Scripting section �3" +&

S script �� ��� �!� Enable &�! Select ��" +&

T %�U��� �VW ��" OK &�!&�!&�!&�! Click ��" +&

X ���� �!� Yes &�!&�!&�!&�! Click ��" +&

���������������������������� 0� E����EA0� E����EA0� E����EA0� E����EA---- @ 96 @ 96 @ 96 @ 96 ����,D�&����,D�&����,D�&����,D�&:::: Firefox 2 �6�! Options � Content setting �$� check ��" 6��! �3 �6!�� �����*�� �� �� ��F

Page 4: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

��!�। �!� �����*� �� ���� �6�� ���� + �। N %1� Tools menu �" Click ��" +&

O "��6� menu +" Options �!&���! ��" +&

P Options � Content tab Click ��" +&

Q �!�Y" ��#! �3 Enable JavaScript check box �� ���� �F ��!�

R %�U��� �VW ��" OK &�!&�!&�!&�! Click ��" +&

���������������������������� 0�0�0�0� F,�� F,�� F,�� F,�� – 0& 96 0& 96 0& 96 0& 96 ����,D�&����,D�&����,D�&����,D�&:::: Opera �" �6�! Preferences � Content setting �$� check ��" 6��! �3 �6!�� �����*�� �� �� ��F

��!�। �!� �����*� �� ���� �6�� ���� + �। N %1� Tools menu �" Click ��" +&

O "��6� menu +" Preferences �!&���! ��" +&

P Preferences � Advanced tab Click ��" +&

Q &�� 6�'� � Z item +" Content �!&���! ��" +&

R �!�Y" ��#! �3 Enable JavaScript check box �� ���� �F ��!�

S %�U��� �VW ��" OK &�!&�!&�!&�! Click ��" +&

������� 0��1 0��/�� /��$ ������� 0��1 0��/�� /��$ ������� 0��1 0��/�� /��$ ������� 0��1 0��/�� /��$ ( Wher e To pl ace Javascr i pt Code)( Wher e To pl ace Javascr i pt Code)( Wher e To pl ace Javascr i pt Code)( Wher e To pl ace Javascr i pt Code)� ��� ��� ��� �� ������������: ������������������������ � �� �� �� �

�"!� ��8��! 0&[�! ��F �3��! ������� ���.� ���� 3�� । N head ��$ � ��"�

O body ��$ � �8�

P &�+\[ (external) file �+��&

head or body � 0&[�! 6FB ��� �#& ��8��!। 3�� �6�! ��! ������� �� ��F# event (�3�! 3�! ���! &�&+�����7 ���!

[�! �,� ��&, event �CD � ��!� ��� +�F) � �6� ��! ���&! ��GH �6�! ������� �� head ��$ ���" 6��!। �&�� 3�� �6�! ������� �� ��! ���" ��! 3�! �6� � �. +& (6#&�&�" 08���� "Hello World!" ���+�!� �"),��GH

�6�! ������� �� body ��$ � �8� ���" 6��!।

&�+\[ (External) ������� ��) &� "��� &�&+�� 6�&�"� 08��� � ��!� ��� +�F ।

HEAD SCRIPT HEAD SCRIPT HEAD SCRIPT HEAD SCRIPT @� P�'�-@� P�'�-@� P�'�-@� P�'�-:::: �3+"# ���� ����F �3 � %���� Script 3� body tag � �8� � �� 3��। ���� ��F# Script � �&� 3�� ��8�� ��F# event

����" +& ।যেমন &�&+�����7 3�! &�! �,� ��& "�! alert box ����&।

Page 5: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

01.<html> 02.<head> 03.<script type="text/JavaScript"> 04.<!-- 05.function popup() { 06.alert("Hello World") 07.} 08.//--> 09.</script> 10.</head> 11.<body> 12.<input type="button" onclick="popup()" value="popup"> 13.</body> 14.</html>

%�'�!:

���� �� ���'! �"�7 ���F 3�� !�� 66�6 &� �� )�� � .]�- � head ��$ ����F �!। ���� 3"&��)

&�! �,� ��&� ""&��) "Hello World!" !��� alert box ����&। 6�&�"� 08���$#� " ���'! &� event �CD �&^���"

� ��!� ��� +�F ।

$�'$�'$�'$�'::::Q $� @A��-R� ������� E�> Q $� @A��-R� ������� E�> Q $� @A��-R� ������� E�> Q $� @A��-R� ������� E�> ( Ext er nal JavaScr i pt Fi l e Tut or i al i n ( Ext er nal JavaScr i pt Fi l e Tut or i al i n ( Ext er nal JavaScr i pt Fi l e Tut or i al i n ( Ext er nal JavaScr i pt Fi l e Tut or i al i n Bangl a)Bangl a)Bangl a)Bangl a) � ��� ��� ��� �� ������������: ������������������������ � �� �� �� �

)�� � .]�- � � � � head &� body ��$ ������� � 0&[�! 6#&�&�"� 08��� � ��!� ��� +�F । �! ����

� ��!� ��&� ":"7� 0&[�! �V�� 3� +2 external ������� file ।

$�'$�'$�'$�'::::Q Q Q Q ( EXTERNAL)( EXTERNAL)( EXTERNAL)( EXTERNAL) ���������������������������� E�> >�,��RE�> >�,��RE�> >�,��RE�> >�,��R ���� �-������ �-������ �-������ �-��:::: external ������� file Import ��� I�� ��#_ ���। %1�" �3 ��) �� Import ��&! ��� �&8 &� '#8#��H �������

file +" +&।�`"7�" ��) extension � 0&'�) ".js" +" +& ।পরিশেষে �6!�� 0&'�) file � 0&[�! ��!" +&। 8�� 3�� "myjs.js" !��� ����� �� file �F 3� � �)!� Hello World !��� alert function � 8��!

��F।��4 8�� 3�� HTML file &� ������� file �) directory �" �F। myjs.js !���!���!���!��� ������� file :

1.function popup() { 2.alert("Hello World") 3.} 01.<html> 02.<head> 03.<script src="/myjs.js"> 04.</script> 05.</head> 06.<body>

Page 6: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

07.<input type="button" onclick="popup()" value="Click Me!"> 08.</body> 09.</html>

%�'�!%�'�!%�'�!%�'�!:

��F# Tips:

N �6�! 3�� �) Script �&��W �6� &�&+�� ��" ��! "�+ external ������� file &�&+�� ��" 6��!। � � �) ���.

%"�� �6�� �!� � ��� %���! �!)। O ��� 8�!� Script � �!� external ������� file &�&+�� ��� 3�� �3�! �! �)6 3� head tag (functions) ����

+� ��� �)6 3� body tag ���� +�। P �6!�� �!�Y" ��" +& �3 external ������� file <script> tag 0?��#_ +& !�। ����! '#8#��H HTML

comment &� ������� code F�a� �� ��F# 1��& !�।

������� F,���� �������� ������� F,���� �������� ������� F,���� �������� ������� F,���� �������� ( JavaScr i pt Oper at or Tut or i al i n ( JavaScr i pt Oper at or Tut or i al i n ( JavaScr i pt Oper at or Tut or i al i n ( JavaScr i pt Oper at or Tut or i al i n Bangl a)Bangl a)Bangl a)Bangl a) � ��� ��� ��� �� ������������: ������������������������ � �� �� �� �

0!��!� �%�L���� ���$#�� � 06��� � ��1 ������� 06��� � �� �F। 06��� +2 �! �� symbol(%"7�) 3� ���! $��!"7� ��� ��" &�&b" +�। �&�'� ��$ �GH ���$# � +2 6��$�!"7�( arithmetic) �3�! �3�$, �&��$ )"���� "&

�&GH !�।

���������������������������� @� ,���V�-&W�@� ,���V�-&W�@� ,���V�-&W�@� ,���V�-&W� F,����F,����F,����F,���� @�@�@�@� &�� ��&�� ��&�� ��&�� ��::::

Operator �1���1���1���1�� ���+�!���+�!���+�!���+�!

+ �3�$�3�$�3�$�3�$ OOOO+QQQQ

- �&��$�&��$�&��$�&��$ SSSS-OOOO

* $#!$#!$#!$#! TTTT* QQQQ

/ ��$��$��$��$ NRNRNRNR/PPPP

% �.# ���.# ���.# ���.# �� QPQPQPQP% NcNcNcNc

���������������������������� F,����F,����F,����F,���� @�@�@�@� 0����$ 0����$ 0����$ 0����$ 9' P�'�-9' P�'�-9' P�'�-9' P�'�-::::

�!� �� ��8��! ���+�! ���� + � �3��! ���� � 6��$�!"7� ��3� �VW +�F । 01.<body> 02.<script type="text/JavaScript"> 03.<!-- 04.var two = 2

Page 7: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

05.var ten = 10 06.var linebreak = "<br />" 07. 08.document.write("two plus ten = ") 09.var result = two + ten 10.document.write(result) 11.document.write(linebreak) 12. 13. 14.document.write("ten * ten = ") 15.result = ten * ten 16.document.write(result) 17.document.write(linebreak) 18. 19.document.write("ten / two = ") 20.result = ten / two 21.document.write(result) 22.//--> 23.</script> 24.</body>

%�'�!%�'�!%�'�!%�'�!:

two plus ten = 12ten * ten = 100ten / two = 5

COMPARI SONCOMPARI SONCOMPARI SONCOMPARI SON F,����F,����F,����F,����:::: variables &� values � �8� �V�� �!d�� ��" Comparison 06��� &�&e" +�। �� equal ��e �3 �� # �� ���� double equal ��e (==) �#� �� #� �8�� "# !� �� Comparison 06��� 3�3�3�3�conditional statement � � � �

��"���"���"���"� &�&e"&�&e"&�&e"&�&e" +�+�+�+� &� &� &� &� �"��"��"��"�, ��1����1����1����1�� �!d���!d���!d���!d�� ��।��।��।��। conditional statement �CD 6�&�"� 08��� � ��!� ��� +�F ।

Operator �1���1���1���1�� ���+�! � ��

== Equal To x==y ��1����1����1����1��

!= Not Equal To x!=y �"��"��"��"�

< Less Than x<y �"��"��"��"�

> Greater Than x>y ��1����1����1����1��

<= Less Than or Equal To x<=y �"��"��"��"�

>= Greater Than or Equal To x>=y ��1����1����1����1��

Page 8: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

������� 0����$ �������� ������� 0����$ �������� ������� 0����$ �������� ������� 0����$ �������� ( JavaScr i pt Var i abl e Tut or i al i n ( JavaScr i pt Var i abl e Tut or i al i n ( JavaScr i pt Var i abl e Tut or i al i n ( JavaScr i pt Var i abl e Tut or i al i n Bangl a)Bangl a)Bangl a)Bangl a) � ��� ��� ��� �� ������������: ������������������������ � �� �� �� �

�����& + + + + �� �� �� �� %"7��%"7��%"7��%"7�� (symbolic) !��!��!��!�� 3�3�3�3� �6!���6!���6!���6!�� �!���;�!���;�!���;�!���; �������� ���������������� �� #��� #��� #��� #� �6[�6!�6[�6!�6[�6!�6[�6! ��।��।��।��। �����& � � � � �f'��f'��f'��f'� +2+2+2+2 �6!���6!���6!���6!��

"1��"1��"1��"1�� ������������ ���������������� 3�"3�"3�"3�" �6�!�6�!�6�!�6�! 6�&�"� "6�&�"� "6�&�"� "6�&�"� " "�"�"�"� &�&+��&�&+��&�&+��&�&+�� ��"��"��"��" 6��!।6��!।6��!।6��!। �����& !���!���!���!��� 3��3��3��3�� ���������������� �� �� �� �� �&���&���&���&�� &��$�&��$�&��$�&��$� ��1��1��1��1 "# !�"# !�"# !�"# !� ������������

"�+ "�+ "�+ "�+ ) ) ) ) &��$�&��$�&��$�&��$� �&����&����&����&��� .����.����.����.���� (data)��1��1��1��1 "# !�"# !�"# !�"# !� ������������ 3��।3��।3��।3��। Variable !��!��!��!�� ( name) ���`���`���`��� .���.���.���.��� ���a�!����a�!����a�!����a�!� 1��1��1��1�� 3�"3�"3�"3�" �6�!�6�!�6�!�6�!

�+��+��+��+� �� �� �� �� move���"���"���"���" 6��!6��!6��!6��!।।।। �����& �����& �����& �����& � � � � ���+�!���+�!���+�!���+�!:

%1�&�� �����& &�&+��� �GH �����& !��� 6#&� "var" � �� ��#�7 !� "& �� programming practice � �!�

%1�&�� �����& !��� 6#&� "var" � �� ���"।�!� ���+�!� ��8�� �&9�� 6��g�� ��� + । 01.<body> 02.<script type="text/JavaScript"> 03.<!-- 04.var linebreak = "<br />" 05.var my_var = "Hello World!" 06. 07.document.write(my_var) 08.document.write(linebreak) 09. 10.my_var = "I am learning JavaScript!" 11.document.write(my_var) 12.document.write(linebreak) 13. 14.my_var = "Script is Finishing up..." 15.document.write(my_var) 16.//--> 17.</script> 18.</body>

%�'�!:

Hello World!I am learning JavaScript!Script is Finishing up...

�6�� ���+�! ���� �#� �����& �"�7 ���F 3�� �� �)! �/�� �!� HTML �� 8�F 06�� +2 .�)!���� �����&

3�� �6�� script � �8� �"!� ��W 8�!� �� # ��F। �����& � �� # �!���; ��" ���! ��e (=) &�&+�� ��" +&। �3��! &�� 6�' 1��& �����& &� .�! 6�' 1��& �����&

� �� #। �3�! my_var = "Hello World!" � ��! +2 my_var ���! "Hello World!" । �����& &� � �� #&��!�� order h� ���" +& 01�Z %1� �����& � !�� 6� �����& � �� # "� !� + script h��" ��� ��& !�।

���������������������������� 0����$ 0����$ 0����$ 0����$ -��� �-��-W�&-��� �-��-W�&-��� �-��-W�&-��� �-��-W�&:::: 3�!3�!3�!3�! �6�!�6�!�6�!�6�! �����& !��!��!��!�� ( name)6FB6FB6FB6FB ��&!��&!��&!��&! "�!"�!"�!"�! 0&'�)0&'�)0&'�)0&'�) G� G� G� G� ���"���"���"���" +&+&+&+& !���!���!���!��� �3!�3!�3!�3! ������� � � � �reserve !��!��!��!�� !�!�!�!�+�।+�।+�।+�। �����& !��!��!��!�� (name)6FB�6FB�6FB�6FB� �� �� �� �� practice + + + + &d!���i �&d!���i �&d!���i �&d!���i � !���!���!���!��� &�&+��&�&+��&�&+��&�&+�� �3!�3!�3!�3! !���!���!���!��� �����& �� #��� #��� #��� #� � � � � �1���1���1���1�� �!��'�!��'�!��'�!��'

Page 9: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

��।��।��।��। �3�!�3�!�3�!�3�! 8�#!8�#!8�#!8�#! �6!���6!���6!���6!�� �����& �� #�� #�� #�� # �#"���#"���#"���#"�� ��)����)����)����)�� �!��'�!��'�!��'�!��' ��F��F��F��F ��GH��GH��GH��GH �����& !��!��!��!�� ��"��"��"��" 6��!6��!6��!6��! "shoe_size"। 3� �#&�+� 6a� &� �&�I� 3�&।

������� �����& !��!��!��!�� ��������������������(cccc-jjjj) ������������ '#�#'#�#'#�#'#�# +&+&+&+& !�।!�।!�।!�। 3�3�3�3� &�&+��&�&+��&�&+��&�&+�� ������������ �&8�&8�&8�&8 !�।!�।!�।!�। �3�!�3�!�3�!�3�!: 7lucky, 99bottle &� 3charm ।�&�� �� +� �����& !��!��!��!�� �� �F� +�"� &d� ��� '#�# ��� &� �����& !��!��!��!�� 3��3��3��3�� �� �� �� �� 0�8�0�8�0�8�0�8� 'k'k'k'k �&�'Z�&�'Z�&�'Z�&�'Z +�+�+�+� "�+ "�+ "�+ "�+

'k$# ��'k$# ��'k$# ��'k$# �� underscore ������������ 6:1�6:1�6:1�6:1� ��"��"��"��" +�।3�!+�।3�!+�।3�!+�।3�!: my_var, strong_man, happy_coder )"����।

������� E�[\- �������� ������� E�[\- �������� ������� E�[\- �������� ������� E�[\- �������� ( JavaScr i pt Funct i on Tut or i al i n Bangl a)( JavaScr i pt Funct i on Tut or i al i n Bangl a)( JavaScr i pt Funct i on Tut or i al i n Bangl a)( JavaScr i pt Funct i on Tut or i al i n Bangl a)� ��� ��� ��� �� ������������: ������������������������ � �� �� �� �

3�� �6!�� ���! �%�L���� � 0��K"� 1�� "�+ ) 08���� �'�" �� ��� �$&। 0!��!� �%�L���� ���$#��� (��, ��++,�6 )��6 )"����) ���'! � �" ������� � ���'! %��) �)। � 3�� �6!�� ���'! �'��� %1�&�� +� 1�� "�+ )

08���� �#& �!�3�$ �+��� 6a� ���"।

E�[\-E�[\-E�[\-E�[\- ��������???? ���'! + � # ��� ���. 3� �#l 0&[�� 1�� 3"Gd 63?� !� "�� ��� ��" & � +�। 6#!��&:�m ���� �GH ���'! 0!� ���

&���n� । ���'! � ��8�� �) ���. &�� &�� !� � � �) ��� &�� &�� ��� 3�� । ������� ���'! � � � � ���+�!���+�!���+�!���+�!:

���'! �� )�� � .]�- � head ��$ � ��"� ���� ���"। ���'! �"�7 ��� �#& �+�। %1� ���'! � !�� ��" +&

"��6� ��8��! ������� ���. � �" +& ।নিচে ���+�!� ��8�� �&9�� 6��g�� ��� + । 01.<html> 02.<head> 03.<script type="text/javascript"> 04.< 05.function popup() { 06.alert("Hello World") 07.} 08.> 09.</script> 10.</head> 11.<body> 12.<input type="button" onclick="popup()" value="popup"> 13.</body> 14.</html>

%�'�!%�'�!%�'�!%�'�!:

���'! �1�� � ��� ��8�� browser �� &#�I��F �3 ���� ���'! &�&+�� ��" 3��2। "��6� ���� ���'! � !�� ����F 3�" �� 6�&�"� " &�&+�� ��" 6���। �3+"# ���� pop up alert �"�7 ���F � ) ���'! �� "popup" ���'! & .��"6���। ) "{,}" /��� ����� ���'! ���. � �7��!� �!8���! ��। �� popup ���'! � ���. ) /��� ��"� � �� +�

Page 10: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

��8��!" �� �&9� �� � �$" 6�� �3 ���� ����& popup ���'! � ��"� ���� alert ���'! &�&+�� �� ��। )alert ���'! � ����� � ��� popup box �+ %�'�! ��। �) + ���'! &�&+��� �&�� &a �&9� "� + � ���'! � ��"�

���'! � &�&+�� ।উপরের ���+�! ����F &�! click ���� � popup box ����F । &�! click ���� event & । �&9� 6�&�"� 08��� � ��!� ��� +�F ।

������� >�?� �������� ������� >�?� �������� ������� >�?� �������� ������� >�?� �������� ( JavaScr i pt Event Tut or i al i n Bangl a)( JavaScr i pt Event Tut or i al i n Bangl a)( JavaScr i pt Event Tut or i al i n Bangl a)( JavaScr i pt Event Tut or i al i n Bangl a) � ��� ��� ��� �� ������������: ������������������������ � �� �� �� �

������� �&9� 6�� '7" &��6�� +2 � G�"� `��� �6!�� .�)!���� 4�&6� ��" ��+�3� ��& । � �6!�� ��)�

����� � �!� %�!&? ,����� ���! �& �7&? �! +&। ��9�!7� 4�& �6� �"�7� ���m +2 ������� )�- । ������� �

)�- + �! � ���!� 3� 4�&6� � ��1 &� � �6� ��F# ��� ।নিচে ������� )�- � ��F# ���+�! ���� + � । N �� ���� �,� O 4�& �6� � �. +4��

P ���e" [�!� �6� ���� ���� 3�� ���� hover !�� ���! । Q )�� � ��� )!6# &M �� �� o ���

R �� keystroke

������� )�-s � � � � ���+�!���+�!���+�!���+�!:

������� � ��F# 6#&��!8����" !�� ��F 3�� ��8�� 0!� )�- � �6� "�� � Z ���� +�F। �6�! 3�! )�- �� �!���;��&! "�! ��F# ��� ����" +�। �6!�� 0&'�) )�- �� �!���; ��" +& ���! HTML element )�- � �!� 06G�

��& &� )�- ��� � ��1 ��1 function ��� ��& ।

���� 6#&�&�" 08��� ������� )�- &�&+�� ���F �� �3��! &�! �,� ���� ��1 ��1 alert popup %�'�! ���F ।এটা�F "onclick" ������� )�- �)। 8�!� ���+�! �!� ���� + � ��1 mouseover &� mouseout )�- �3�$ ���

+ � । view source print? 01.<html> 02.<head> 03.<script type="text/javascript"> 04.<!-- 05.function popup() { 06.alert("Hello World") 07.} 08.//--> 09.</script> 10.</head> 11.<body>

Page 11: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

12. 13.<input type="button" value="Click Me!" onclick="popup()"> 14. 15.</body> 16.</html>

%�'�!%�'�!%�'�!%�'�!:

������� 0^��?� 0^��?� ������� 0^��?� 0^��?� ������� 0^��?� 0^��?� ������� 0^��?� 0^��?� �������� �������� �������� �������� ( JavaScr i pt St at ement Tut or i al ( JavaScr i pt St at ement Tut or i al ( JavaScr i pt St at ement Tut or i al ( JavaScr i pt St at ement Tut or i al i n Bangl a)i n Bangl a)i n Bangl a)i n Bangl a) � ��� ��� ��� �� ������������: ������������������������ � �� �� �� �

�6�! )2��" ������� ���. � �" 6��! "& �&�'� ��$ �GH ������� ���.$# � 6:1� 6:1� �Z�- &� �&&:�" `��� $h" । �� �Z�- �����& �� ��" 6�� 3� �� #� ���! । �� �Z�- ���'! �� � ��" 6��। �Z�- �!��' �� �3 Script

�� ��& &� ����& ��� ��& ।

0^��?�0^��?�0^��?�0^��?� @� 9���`@� 9���`@� 9���`@� 9���`:::: 0!��!� �%�L���� ���$#���(��,�6 )��6 )"����) � ����l �!��' ��" semicolon(;) &�&+�� ��� +�।���� ������� ���F

�3 semicolon(;) � &�&+�� &�8�&�8�"� �&9� !�।

0^��?�0^��?�0^��?�0^��?� @�@�@�@� .����P.����P.����P.����P::::

��!�p" �Z�- 3��� �����& � ��! 6��&"� !, !"# ! ��! %��! ��� &� ���'! �� .��� )"���� ��� �q& ।যাহোক ��F#

%���� �Z�- ��F 3��� "��� �f'� 0!#3��7 � 06� +" 6:1� ।

) 08��� ���� �& %���� �Z�- � ���Gl 8��!� ��& "& 6�&�"� 08��� �� �&9� � ��!� ��� +&। �!� �� %���

��� �r� ��� + । NNNN ��='!� ��='!� ��='!� ��='!� ('"� &���'"� &���'"� &���'"� &���) �Z�-�Z�-�Z�-�Z�-

OOOO #6 #6 #6 #6 (6#!��&:�m6#!��&:�m6#!��&:�m6#!��&:�m) �Z�-�Z�-�Z�-�Z�-

P 0&�o0&�o0&�o0&�o (& i& i& i& i) ����!6# '!����!6# '!����!6# '!����!6# '! �Z�-�Z�-�Z�-�Z�-

Q ��-��-��-��- (�?&��?&��?&��?&�) �Z�-�Z�-�Z�-�Z�-

R M�6'! M�6'! M�6'! M�6'! (&��"U�&��"U�&��"U�&��"U�) +��=� �+��=� �+��=� �+��=� � �Z�-�Z�-�Z�-�Z�-

��='!� �Z�-:

3��3��3��3�� �6�!�6�!�6�!�6�! NccNccNccNcc ��� �!��� �!��� �!��� �! . ���. ���. ���. ��� ��� ��� ��� ��� ��"!��"!��"!��"! , "&"&"&"& �6�!�6�!�6�!�6�! �q&"�q&"�q&"�q&" �������������������� �Fa�Fa�Fa�Fa ��&!।'9���&!।'9���&!।'9���&!।'9� ���� '"�&���'"�&���'"�&���'"�&���( conditional) if/then

statement 3�3�3�3� �%�L�����%�L�����%�L�����%�L���� � � � � �GH�GH�GH�GH 0�8�0�8�0�8�0�8� 6����!6����!6����!6����! &�&+��&�&+��&�&+��&�&+�� +�+�+�+�।।।।

Page 12: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

3��3��3��3�� ��F#��F#��F#��F# '"�'"�'"�'"� (condition) (01��01��01��01��ZZZZ ��� ��� ��� ��� ��"���"���"���"�)�"��"��"��"� +�+�+�+�, "&"&"&"& ��F#��F#��F#��F#(�6!���6!���6!���6!�� �������������������� �Fa�Fa�Fa�Fa ����������������) �&�&�&�& ।।।। 3��3��3��3��

'"�'"�'"�'"� (condition)(01��01��01��01��ZZZZ �6�!�6�!�6�!�6�! ��� ��� ��� ��� ��""��""��""��"" 6��!�!6��!�!6��!�!6��!�!)��1����1����1����1�� +�+�+�+�,"&"&"&"& �6�!�6�!�6�!�6�! ��)��)��)��) ����������������(�������������������� �Fa�Fa�Fa�Fa ����������������)��"��"��"��" 6��&!6��&!6��&!6��&! !�!�!�!�।।।।

�6!���6!���6!���6!�� Script �� �!�s! ���� �!� ��='!� �Z�- &�&+�� ��� +� 3�" 0&[�� 6��%�G" �&��W ��� ��� 3�� । 8�#!�6�! ���! �&'9 F�& F#�� ��! �6!�� website � home page ����" ��!। ) '"� �!�� � �� ��!� �� �F &� 3�� �

F#�� ��! +� "& F#�� ��!� �!� ���� �&'9 F�&� �6!�� website- ������ ���! %��'�" +&। ��='!� �Z�- �CD �h� K�! F�a� �6�! �6!�� website �� %"��'� 0!#3��7 %�!&?,��9�!7�,.��!���� ��" 6��&!

!�।

a, a, a, a, ((((,a-��$b�c,a-��$b�c,a-��$b�c,a-��$b�c) ) ) ) 0^��?�0^��?�0^��?�0^��?� �6�! �� ��!4 �&�� �!�s!6H 6�h��F !? 3�� !� 6�A�! "& ��!#! � ��& 6�A�" +�। %1� �!�s!6H� �!&! "��6���� t#��&!,���� �#� 1#1# ��� ����&!, �#�� �� ��& ��&! "��6� 6�h� ��&!। 3�� �6!�� Ncc� �!�s!6H 1�� "&

&��� jj� �)��& ��" +&। ��& &��&�� �) ��� ��� �&��_��।

"& ���! �+� 6u�" �� �F? +��n ,�%�L���� � �GH �+� �6�� �F "� ������� ��� ��� 3��। ) 6u�"� !�� +2

"looping"।সঠিক 6���v!�� ��8�� looping � ��+�3� �6�! �6!�� �F� �#B� Script �� '�_'� 7 ���G� 0w 6��!"

��" 6��&!।

loop statement "�? �� ��� �3, ���! '"� �"� +2 ��!�।3�� ���! '"� �"� +� "& loop statement � '"���6G������� ���.� ��� 6��!" ��। ������� ���.� ��� 6��!" ��� 6� '"��" �&�� ��� �� ���� +�। 3�� '"� h� 1��"& %�U��� �&�� '#�# +�। 3�� '"� ��1�� +� "& loop (01��Z 6#!��&:�m ���) �1� 3�&।3�� ���� �&&�+� �!�s!6H� �1���?� ��� "& %1� ���� ��� ��&� ���! �!�s6H &��� �F ��!�। &��� 1�� "�+ �� ���� �$� �" ��� 6#� 6�A�&�।

�� 3�� &��� !� 1�� "& looping &D +� 3�& ।

F$�d F$�d F$�d F$�d (((($e�$e�$e�$e�) ) ) ) �f��-,a \- 0^���f��-,a \- 0^���f��-,a \- 0^���f��-,a \- 0^��?�?�?�?�

object model � �#3�$ �#�&8� �6" ) statement $# � &�&e" +� । �#+#"� �6!��� 3�� object model �CD !� &#I!

"& ����� �!) �&9� 6� � ��!� ��� +�F।

��?� ��?� ��?� ��?� ((((�g$f�g$f�g$f�g$f)))) 0^��?�0^��?�0^��?�0^��?� Comment statement `��� �6�! �3 ���.� ��� �$�" ��! !� ��) ���.� /����� ��3� �VW +4�� �1� �&�" ���"

6��! । "& �! %x ��$" 6�� ��! ���� "� ��" ��)? "�� 0!� ���! ��F। �3�& � ��� ���� %��'� 0!#��" ��)�!

���& '#8# ���� �!��� �!� ����F 3� HTML comments � �"। �&�� ����� %���! �" ���& ���.� ��3 �$�"

Page 13: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

6���।

Single �)! comment �#� //(slash) 1��। �� 0�8� �)! �&�'; '#�# +� (/*) ��� &� �'9 +� (*/) ���।6�&�"� "

�&9� �&^���" � ��!� ��� +�F।

������� >E 0^�?� �������� ������� >E 0^�?� �������� ������� >E 0^�?� �������� ������� >E 0^�?� �������� ( JavaScr i pt I f St at ement Tut or i al i n ( JavaScr i pt I f St at ement Tut or i al i n ( JavaScr i pt I f St at ement Tut or i al i n ( JavaScr i pt I f St at ement Tut or i al i n Bangl a)Bangl a)Bangl a)Bangl a) � ��� ��� ��� �� ���4��!# ���4��!# ���4��!# ���4��!# � �� �� �� �

������� program �� �!�#n" ��" �6!�� ��='!� �Z�- &�&+�� ��" +& 3� �6!�� program �� ��u�? �!" ��+�3�

��& । �!��!� �%�L���� ���$#��4 ��='!� �Z�- &�&+�� �� ������� "�� &��"U� !�।����& &� ��F# %����

data-� �6� ���m �� "If Statement" � ��+�3� ��u� �? �!�� 3��।���+�! y�#6 �6!�� variable 1��" 6�� 3� "1� ������। �6!�� ) G#z "1�� ��+�3� �6�! �F� Script � ��8�� �+� �%�L�� �"�7 ��" 6��!। "Today is my

Birthday!" ) &���� "�!) %��'�" +& 3�! ��! &� ��� �6!�� �{��!� ���! +&।

���������������������������� I F STATEMENT SYNTAX(I F STATEMENT SYNTAX(I F STATEMENT SYNTAX(I F STATEMENT SYNTAX( �67�67�67�67) :) :) :) : If Statement � %8�! �#� 0�' ��F "�� �� ��='!� �Z�- &� 06�� + �!���; ���. 3� ��3� 6��!" +&। ��='!� �Z�- + �! �� �Z�- 3� �"�, ��1�� 3���) ��।&�'� ��$GH ��='!� �Z�- ��� ���! ��F# ��� ��" &�&e"

+�3�� ��F# "�� �� #� ���! +� ।উদাহরন y�#6 & � 3�� � ��� ��& 3�� "����� �6!�� �{��!� ���! +� ।

�!� ������� ���. � �� + "� ��3� 6��!" +& 3�� If Statement '"�� �"� +�।�!� If Statement ���+�! ���� + � ।���� �� ���� ���" 6�& 3�� variable � T � ���! +� । 01.<script> 02.<!-- 03.var myNum = 7; 04. 05. 06.if(myNum == 7){ 07.document.write("Lucky 7!"); 08.} 09.//--> 10.</script>

%�'�!%�'�!%�'�!%�'�!:

Lucky 7!

�6�� ���+�! variable !��

����F myNum &� "�� �� # �� �� ����F "� +2 T। Num ��! & "!C� �&�I��।"��6� ���� ��� �� ���&� �3 If Statement' � '"�� 6#�#! +2 ��!� 01��Z myNum ���! T +2 ��!� ("myNum == 7") 3�� +� "& �� �"� &

�&&�!� ��&।� �����( Lucky 7! )%��'�" +& ।

Page 14: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

���! ��='!� �Z�- � �"� �F �3 ���.� ����� If Statement ("document.write...") � ��1 ���|; �F "�

��3� 6��!" +�F।

���������������������������� I F STATEMENT: ELSEI F STATEMENT: ELSEI F STATEMENT: ELSEI F STATEMENT: ELSE

� � ��!� ��� +�F �3 3�� '"�� �"� +� "& ����& ���. ��3� 6��!" +� ।কিনত 3�� '"�� ��1�� +� "& �6�! �6!��

)2� 0!#3��7 ���� ���.� ��3� 6��!" ��" 6��!। � +2 If Statement � &�8�" 0�'(extension) "� +2

Else clause ।

Else clause � ��� �� 3�! ��='!� �Z�- � ��1�� +�। �6�� ���+�!� ��1 ���� '#8# Elseclause �3�$ ���F

&� myNum � �� # (T � 6��&"� Nc)6��&"� ! �� ����F 3�" ����� ��='!� �Z�- � ��1�� +�। 01.<script> 02.<!-- 03.var myNum = 10; 04. 05. 06.if(myNum == 7){ 07.document.write("Lucky 7!"); 08.}else{ 09.document.write("You're not very lucky today...") ; 10.} 11.//--> 12.</script>

%�'�!%�'�!%�'�!%�'�!:

You're not very lucky today...

������� @ 9 >E �������� ������� @ 9 >E �������� ������� @ 9 >E �������� ������� @ 9 >E �������� ( JavaScr i pt El se I f St at ement Tut or i al ( JavaScr i pt El se I f St at ement Tut or i al ( JavaScr i pt El se I f St at ement Tut or i al ( JavaScr i pt El se I f St at ement Tut or i al i n Bangl a)i n Bangl a)i n Bangl a)i n Bangl a) � ��� ��� ��� �� ������������: ������������������������ � �� �� �� �

6#&&�"� 08��� �6!��� �'�F! �3, �������- ����& basic If Statement �"�7 ��� 3��। single If Statement

�� 0�8� '"� �!d�� ���� �GH basic If Statement � �+��"� ��� 1��। Else If statement + basic If Statement � �� extension 3�� ��8�� �6�! 0!�$# � conditional

statement �"�7 ���" 6��!।

���������������������������� ELSE I FELSE I FELSE I FELSE I F @� P�'�-@� P�'�-@� P�'�-@� P�'�-:::: 8�#! �6�! ��2! �6!�� �F� "student" script � customized ���� ���� %��'�" �+�� 3� �!�� � �� �� 4�& �6� �&�&+�� ��F। 3�� �6!�� �� 0�8� custom ���� 1�� "& extension �+��& �6�! Else If statement �

Page 15: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

&�&+�� ��" 6��!। 01.<script> 02.<!-- 03.var visitor = "principal"; 04. 05. 06.if (visitor == "teacher"){ 07.document.write ("My dog ate my homework..."); 08.} else if (visitor == "principal") { 09.document.write ("What stink bombs?"); 10.} else { 11.document.write ("How do you do?"); 12.} 13.//--> 14.</script>

%�'�!%�'�!%�'�!%�'�!:

What stink bombs?

��ia jkl,a-R �$��ia jkl,a-R �$��ia jkl,a-R �$��ia jkl,a-R �$m�:m�:m�:m�: N Else If statement &�&+�� ���� �$ �6!�� 0&'�) ��8��! If Statement &�&+�� ��" +&। ���!Else

If statement � +2 basic If Statement � &�8�" 0�'। O �6!�� 0!� $# � Else If statement 1��" 6��, �6�� ���+�! ���� ��H Else If statement �� &�&+�� ���F

"& �6�! �6!�� )2� �" Else If statement &�&+�� ��" 6��!।

������� 0'���> a, ������� 0'���> a, ������� 0'���> a, ������� 0'���> a, �������� �������� �������� �������� ( JavaScr i pt Whi l e Loop Tut or i al i n ( JavaScr i pt Whi l e Loop Tut or i al i n ( JavaScr i pt Whi l e Loop Tut or i al i n ( JavaScr i pt Whi l e Loop Tut or i al i n Bangl a)Bangl a)Bangl a)Bangl a) � ��� ��� ��� �� ������������: ������������������������ � �� �� �� �

while loop + �� advance �%�L���� 6u�" 3�� ��8�� ���! ��� &��&�� ��" 6��! 3�! �6!�� ��='!� �Z�- �

�"� +& । 3��4 while loop � ��8��! &�&+�� �# �� । 08��� �6!���� ����&� ����& ������� while

loop �"�7 ��� 3��।

���������������������������� WHI LE LOOPWHI LE LOOPWHI LE LOOPWHI LE LOOP @� $f�%f�@� $f�%f�@� $f�%f�@� $f�%f�::::

������� while loop � %8�! �#� 0�' ��F।

N while loop � ���. ��3� 6��!" +4��� �!� 0&'�) ��='!� �Z�- �� �"� +" +&।

O while loop � ���. &���!� /�� "{ }" 8��! �� 3� ��� 6��!" +& 3�� ��='!� �Z�- � �"� +�।

Page 16: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

3�! while loop '#�# +�, ������� ��� �� ��� �3 condition statement � �"� +�F ��!� ।যদি �"� +� "& &���!�/�� "{ }" � �8�� ���.� ��3� 6��!" +& ।কোড 0�'� �'9 "}" while loop � �&�� condition

statement ��� 3�� &� �&�� '#�# +�।

3�� condition statement � �&��� �"� +� "& �6�! ��!4 while loop +" �&� +� ��" 6��&! !� । "�) while

loop &�&+��� ��� �"�� +4�� ���"।

9�n��-9�n��-9�n��-9�n��- WHI LE LOOPWHI LE LOOPWHI LE LOOPWHI LE LOOP @� P�'�-@� P�'�-@� P�'�-@� P�'�-::::

���+�! ����!� +�F ����& basic while loop �"�7 � 3��। 3�� document.write �� Nc &�� ��3� 6��!" ��F ।"��6� loop statement +" �&� +� �F । 01.<script type="text/javascript"> 02.<!-- 03.var myCounter = 0; 04.var linebreak = "<br />"; 05.document.write("While loop is beginning"); 06.document.write(linebreak); 07. 08.while(myCounter < 10){ 09.document.write("myCounter = " + myCounter); 10.document.write(linebreak); 11.myCounter++; 12.} 13. 14.document.write("While loop is finished!"); 15.</script>

%�'�!%�'�!%�'�!%�'�!:

While loop is beginningmyCounter = 0myCounter = 1myCounter = 2myCounter = 3myCounter = 4myCounter = 5myCounter = 6myCounter = 7myCounter = 8myCounter = 9While loop is finished!

����� variable myCounter � c +" '#�# +�3� Nc +" �F�, � while loop � ���.� ��3� 6��!" ��" 6��। �� #

c 3� /����� %��'�" +�। "��6� variable myCounter N �� &:�u 6�� &� while loop 6#!��� '#�# +�।

Page 17: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

N 3� Nc +" �F� � while loop � ���. ��3� 6��!" +& । %�U��� � " 1��& ।

myCounter 3�! Nc 3� Nc +" �F� !� ��GH while loop � ���. ��3� 6��!" +& !� । "�) �� # Nc %��'�" +� �!। �

�'9 �� # �+��& j %��'�" +�F।

������� E� a, �������� ������� E� a, �������� ������� E� a, �������� ������� E� a, �������� ( JavaScr i pt For Loop Tut or i al i n Bangl a)( JavaScr i pt For Loop Tut or i al i n Bangl a)( JavaScr i pt For Loop Tut or i al i n Bangl a)( JavaScr i pt For Loop Tut or i al i n Bangl a)� ��� ��� ��� �� ������������: ������������������������ � �� �� �� �

������� �� #6 0!��!� �%�L���� ���$#��� �� #6 � �" । � &�&+�� +� 1��

3�! �6!�� 0!�&�� ���! �!���;( set of operations) ��� ���� %���! +� &� �!���; ���. � ��8�� %"��&�� ��� � ��

6� ��F# ���!� &:�u 6�� ।

���������������������������� E� a,E� a,E� a,E� a, @� $f�%f�@� $f�%f�@� $f�%f�@� $f�%f�::::

������� �� #6 � ���� $#�#E6#!� �&9� ��F। N counter variable �� '#8#��H �� #6 � �GH &�&+�� ���� �!� �"�7 � +�F। ) counter variable `��� $!!� ���

+�3 �"&�� �� #6 � 6#!��&:�m �&। i + counter variable � ��8��! � � । O conditional statement � ��u�? �!� �3 �� #6 � 0!&�" ��� (executing)�!����" +& �� +& !�। ��F# �6�� �

counter variable �� ���(check) ��। P �� #6 � increment ���'! %"�� loop &� 6#!��&:�m� 6� counter variable � &:�u +�। ) &:�u� 6����! ���. � ��

1��।

Q �� #6 � �8� ��� %"� loop &� 6#!��&:�m� �!� �!���; ���. ���(executed) 6��!" +�।

� 0}#" �! +" 6�� "& N-P �&) �) �)!� ���. � �!� �। � ���! +2 ��

#6 standard�%�L���� � 0!#'7 !।যা designer $d 0!#�& ��" 6�� । �� #6 � ��8�� ��F# �~� &� �&':�� � +" �G�

6�4�� 3��।

���������������������������� E� a,E� a,E� a,E� a, @� P�'�-@� P�'�-@� P�'�-@� P�'�-:::: ) ���+�!� ��8�� ���� ���& �3 ����& ��8��! �� #6 �"�7 ��� 3�� &� ����� counter � value %��'�" +& 3"G!!� counter R �6�F��। loop ���.� %1� �)!� �"!� ��W (i = 0; i < 5; i++)item � ��� �&'9 �!�3�$ ����

���"। $# � �� #6 � $#�#E6#!� �&9� 3� �6�� N +" P 6�- � ��!� ��� +�F। 01.<script type="text/javascript"> 02.<!-- 03.var linebreak = "<br />"; 04.document.write("For loop code is beginning");

Page 18: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

05.document.write(linebreak); 06. 07.for(i = 0; i < 5; i++){ 08.document.write("Counter i = " + i); 09.document.write(linebreak); 10.} 11. 12.document.write("For loop code is finished!"); 13.</script>

%�'�!%�'�!%�'�!%�'�!:

For loop code is beginningCounter i = 0Counter i = 1Counter i = 2Counter i = 3Counter i = 4For loop code is finished!

counter variable !�� (name) i �� ��� 0}#" �$" 6�� "& � &�&+�� +� ��F। ��9� ���! ����� !�। i +2

loop counter � default (name) !�� । 0!��!� ��! variable !�� +2 j,k,x,y &� z। ) ���+�! ����� counter �� %1� c �" ("i = 0;") �� ��� +�F। "��6� conditional statement �� ("i < 5;")

��� +�F। ����� counter R +" �F� "�) �� #6 � ���. ���(executed) 6��!" +�F । �� #6 � ���. ���(executed) 6��!" +4��� 6� ("i++") &:�u �F। counter i ���! N �+��& �"�7 ��� +�F

।তারপর ��� ��� +� 3�� R � ��� �F� +� "& 6#!��� �� #6 � ���. ���(executed) 6��!" +�। ) looping � "

1�� 3"G! !� counter i R � ���! +2 । ��?i R �"� R +" �F� !� � �� #6 � ���. ���(executed) 6��!" +4��

&D +� 3�&।

������� �g$f ������� �g$f ������� �g$f ������� �g$f ( JavaScr i pt Comment s Tut or i al i n Bangl a )( JavaScr i pt Comment s Tut or i al i n Bangl a )( JavaScr i pt Comment s Tut or i al i n Bangl a )( JavaScr i pt Comment s Tut or i al i n Bangl a )� ��� ��� ��� �� ������������: ������������������������ � �� �� �� �

�6�! �� ��!4 Script &� �%�L�� 0"7" � �F! 3� F� ��� �$ ���F! ��?i ���! 8��!� �!) �3 ) ���. ��� �6�! ��

��&!।�6�! �q&" �# �$F! �� ��" ����F !।��!� ��-� (Comments)� �� ���"। 3�! �6�! ���. � �! "�! �6!�� 0!� �� ��� 1��" 6�� "& �&�� �� +� ���.� ��1 ��F# ��-�(Comments)0?��_ ��� 3� �6!�� &����� ��& �� +" 3�2। � '#8# �6!�� 6�&�"� " y�! ���" ��+�3� ��& "� !�, �6�! 3�� �6!�� ���. ���� ����! "& "���4 �#& �+� ���. &#I" 6��&। ��-�(Comments) � ���� &a �#�&8� +2

3�! �6!�� ���.� �# �� �#� ���� ��� ��-�(Comments) � ��+�3� 0!������" ���. �#� ��" 6��&!। ) 08��� �6!��� ����&� ����& �#) 8�!� ��-�(Comments) JavaScript � �� 3��

N single �)! ��-�( comments )

O multi- �)! ��-�( comments )

Page 19: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

SI NGLE LI NE COMMENTSSI NGLE LI NE COMMENTSSI NGLE LI NE COMMENTSSI NGLE LI NE COMMENTS p&�W ���p&�W ���p&�W ���p&�W ���:::: ������� single �)! ��-�( comments ) �"�7 ��" + �6!�� ���. &� text � ���! �#� >��� (slashes) "//" ��" +&।��� 6��!" &� %��'�" +& !�। 3�! �6�! ) �#� (slashes) "//" ��&! "�! "�� .�! 6�'� �� text %��'�" +&

!�।3"G! !� 6�&�"� �)! 3��। 1.<script type="text/javascript"> 2.<!-- 3.// This is a single line JavaScript comment 4. 5.document.write("I have comments in my JavaScript code!"); 6.//document.write("You can't see this!"); 7.//--> 8.</script>

%�'�!%�'�!%�'�!%�'�!:

I have comments in my JavaScript code!

MULTIMULTIMULTIMULTI ---- LI NE COMMENTSLI NE COMMENTSLI NE COMMENTSLI NE COMMENTS p&�W ���p&�W ���p&�W ���p&�W ���:::: 3��4 single �)! ��-� (comments ) �����#� �6���7 "& 3�! �6�! ���! &a 0�'� ���. �� 0G� ���" ��! ��GHsingle �)! ��-�( comments ) � &�&+�� ��!4 ��!4 �&�I� +� ��a��। ��� &a 8�!� ��-�( comments )

� �!� ������� multi- �)! ��-�( comments ) &�&+�� ��� ���"।3� '#�# +� /* ��� &� �'9 +�*/ ���। 01.<script type="text/javascript"> 02.<!-- 03.document.write("I have multi-line comments!"); 04./*document.write("You can't see this!"); 05.document.write("You can't see this!"); 06.document.write("You can't see this!"); 07.document.write("You can't see this!"); 08.document.write("You can't see this!"); 09.document.write("You can't see this!"); 10.document.write("You can't see this!");*/ 11.//--> 12.</script>

%�'�!%�'�!%�'�!%�'�!:

I have multi-line comments!

������� Ff�� �������� ������� Ff�� �������� ������� Ff�� �������� ������� Ff�� �������� ( JavaScr i pt Ar r ay Tut or i al i n Bangl a)( JavaScr i pt Ar r ay Tut or i al i n Bangl a)( JavaScr i pt Ar r ay Tut or i al i n Bangl a)( JavaScr i pt Ar r ay Tut or i al i n Bangl a)� ��� ��� ��� �� ������������: ������������������������ � �� �� �� � 0��� + �� �����& 3� �!�� �8� 0!�$# � �����& ��� �� ���" 6��। 0!� �%�L���� 0!� ���$#��� 0��� ���F 3�

������� +" ��W !�।

3�! �6!��� ������� 0��� &�&+�� ��&! "�! �!�� 6�-�$# � 0&'�) �! ���� ���"।

Page 20: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

N 0��� +2 �� �&'9 8�!� �����&

O array name &�&+�� ���� ��8�� 0��� � �� #� ��� �� ���� +�। 0��� �" 0&[�! h� �� �6!�� )2� 0!#3��7/�� �� # ��� �� ���" 6��!। �3�!: myArray[2] = "Hello World";

P array name � ��8�� �� # &� "�� 0&[�! �&� 3�� ।যেমন: myArray[2]

Q ������� 0��� � �!� built-in function ��F। "�) &�&+�� ���� �$ ��� �!�� ���"।

���������������������������� Ff��Ff��Ff��Ff�� p&�W� �-��p&�W� �-��p&�W� �-��p&�W� �-��:::: ��8��! �����& �"�7 ��� +" 0��� �"�7 ��� ��F#� ��W। ���! JavaScript �����& &� property ��F 3� 0��� ���+" ���|;। !"# ! 0��� �"�7 ��" �6�! special function &�&+�� ��" 6��!। �!�� ���+�!� ��8�� ����!� +�F �3

����& �6�! ��8��! 0��� �"�7 ��" 6��&!, ����! �� # ��� ���" 6��&!, ��) �� # �!d�� ��" 6��&!। 01.<script type="text/javascript"> 02.<!-- 03.var myArray = new Array(); 04. 05.myArray[0] = "Football"; 06.myArray[1] = "Baseball"; 07.myArray[2] = "Cricket"; 08. 09.document.write(myArray[0] + myArray[1] + myArray [2]); 10.//--> 11.</script>

%�'�!%�'�!%�'�!%�'�!:

FootballBaseballCricket

G� �6�! /�� �� #� position h� �� ����� � �6!�� )2� 0!#3��7 �� # �&� ��" �6�F!।

������� Ff��������� Ff��������� Ff��������� Ff�� 9��R[9��R[9��R[9��R[::::

8�#! �6�! 0��� �� &d��� � 0!#��� ����" (sort) ��! "� ���� 0��� � sort method � ��8�� ��" 6���। 01.<script> 02.<!-- 03.var myArray2= new Array(); 04. 05. 06.myArray2[0] = "Football"; 07.myArray2[1] = "Baseball"; 08.myArray2[2] = "Cricket"; 09. 10. 11.myArray2.sort(); 12. 13. 14.document.write(myArray2[0] + myArray2[1] + myArr ay2[2]); 15.//--> 16.</script>

Page 21: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

%�'�!:

BaseballCricketFootball

������� @ ��R E�\- �������� ������� @ ��R E�\- �������� ������� @ ��R E�\- �������� ������� @ ��R E�\- �������� ( Javascr i pt Al er t Funct i on Tut or i al ( Javascr i pt Al er t Funct i on Tut or i al ( Javascr i pt Al er t Funct i on Tut or i al ( Javascr i pt Al er t Funct i on Tut or i al i n Bangl a)i n Bangl a)i n Bangl a)i n Bangl a) � ��� ��� ��� �� ������������: ������������������������ � �� �� �� �

3�� �6!�� 4�& /����� ������� �o� ��� !� 1�� "�+ �6�! Alert ���" 6�&! !�। ������� �� +2 ��

.��� $ &M 3� pops up &� � �" /����� �)=� +" �:�; ��� 9! ��। 4�& /����� �� Alert ����� 6a" &�8� ��।

r%- +���r%- +���r%- +���r%- +��� POPUPS / ALERTSPOPUPS / ALERTSPOPUPS / ALERTSPOPUPS / ALERTS $f$'�� ��$$f$'�� ��$$f$'�� ��$$f$'�� ��$::::

�!�� 0&[�� �GH JavaScript alert &�&+�� ��� 3��।

N �6�! 3�� �!�Y" +" ��! �3 &�&+�����7(user) website ���! ��F# ���� �$ ���� ���!।

O ��F# �&9� �CD &�&+�����7�(user)�"�� ��" । �3�!: ) ����� ��� �"�� ��" 6��!

"the following page contains humor not suitable for those under the age of 14"

P �� �# +� �$F। &��6�� �6�! &�&+�����7�(user) ��!�" ��!। Q ��F# ���� &��6�� �!�Y" +" &�&+�����7�(user) ��K��� ��" 6��!। �3�!: 3�� "��� &��a� �# �_� &��6�� ��)! ��"

���� +� "& �6�! "���� �&�� ��K��� ��&! 3�� "��� �# �_� &��6�� �!�Y" "& "��� ) ��u�?� �4"�� 6a&।

9�n��-9�n��-9�n��-9�n��- ������� @ ��R������� @ ��R������� @ ��R������� @ ��R::::

8�#! ���� �� �"�7 ���F �3��! �!$!� & � +�F &��a ���! %��! �# �_� &��6�� ।ফলে �!$!� ��1 �# �_� &��6�� �!�Y"��� �!� ����� �� alert 3� 4�&��) �3�$ ��" +&। �!�� ���. alert 3#_ ��� +�F �3��! )�� � &�

&�! onClick event 3#_ +�F। 1.<form> 2.<input onclick= 3."alert('Are you sure you want to give us the deed to your house?')" 4.value="Confirmation Alert"> 5.</form>

%�'�!%�'�!%�'�!%�'�!:

String 01���Z alert � /��� ��"� �3 � ��� "� alert box � ��"� �%- +� �F &�! �,� ���� ��1 ��1 �����

���! %��'�" +&।

Page 22: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

������� �-E��R E�[\- �������� ������� �-E��R E�[\- �������� ������� �-E��R E�[\- �������� ������� �-E��R E�[\- �������� ( Javascr i pt Conf i r m Funct i on ( Javascr i pt Conf i r m Funct i on ( Javascr i pt Conf i r m Funct i on ( Javascr i pt Conf i r m Funct i on Tut or i al i n Bangl a)Tut or i al i n Bangl a)Tut or i al i n Bangl a)Tut or i al i n Bangl a) � ��� ��� ��� �� ������������: ������������������������ � �� �� �� �

JavaScript confirm ���'! &� JavaScript alert ���'! %�� �) ���। � �� �F� .��� $ &M 3� 4�& �6� �

���! ������ �:�; 6�" ���� �!� %��'�" +�।confirm box 3� alert box +" ��W ।এটা &�&+�����7� �#� 06'! ���:

N 66�6 ����� 3�� "��� confirm ��" ��� "& OK �%� ��" +&।

O &� 66�6 ������ ��1 ��" !� +� "& cancel �%� ��" +&।

���! ��F# �!�Y" ���� �!� confirm ���'! � %��) &�&+�� +� 1��। ) $#�#E6#!� ���� website � ��8�� �VW ��� +�।&�&+�����7$! ���! ��F# submission &� &�&+�����7� �&K�l %��! �� �3 "��� �3 � �� �,� ��F "�� ��8�� 0!�

website �3" )2#� ��!�।

JAVASCRI PT CONFI RM JAVASCRI PT CONFI RM JAVASCRI PT CONFI RM JAVASCRI PT CONFI RM @@@@� P�'�- � P�'�- � P�'�- � P�'�- :::: 01.<html> 02.<head> 03.<script type="text/javascript"> 04.<!-- 05.function confirmation() { 06.var answer = confirm("Leave webcoachbd.com?") 07.if (answer){ 08.alert("Allah hafiz!") 09.window.location = " http://www.google.com/ "; 10.} 11.else{ 12.alert("Thanks for staying with us!") 13.} 14.} 15.//--> 16.</script> 17.</head> 18.<body> 19.<form> 20.<input type="button" onclick="confirmation()" value="Leave webcoachbd.com"> 21.</form> 22.</body> 23.</html>

%�'�!%�'�!%�'�!%�'�!:

���.� � 0�'� ��� G� ��#!।���! ���� �� �����+ ("Leave webcoachbd.com?")

���'! �� �.��F।� JavaScript popup window �"�7 ��F 3�� �#� �&9� 6FB ���� 06'! ��F। ������� �� #

����� �! 3� �!�� � �� &�&+�����7 ���! &�! �,� ��&।

3�� &�&+�����7 OK �,� �� "& �� # N ��� ��&, 3�� &�&+�����7 cancel �,� �� "& �� # c ��� ��&। ����

Page 23: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

answer � �8� ) �� #� ��� ����। ) answer �� confirm ���'! � ���! �+��& �� ���।

Answer �� # ��� ����� 6�,���� Answer �� ��='!� �Z�- �+��& &�&+�� ���F। 3�� Answer 'i!� F�a� 0!� ��F# +�"& ���� &�&+�����7� ����� webcoachbd.com +" 0!� ���1�4 6�h� ��&�। 3�� Answer ���! 'i!� +� "&

&�&+�����7 ����� ��) 1��& ���! &�&+�����7 cancel &�! �,� ��F।

%�"GH) ������� alert box %��'�" +& 3� &�&+�����7� ��!�& �� +" 3�2। 3�� �6�! ����� ��)� "��$ ��" ��!

"& "Bye bye!" %�'�! ��& �� 3�� ����� ��) 1��" ��! "& "Thanks for sticking around!" %�'�! ��&।

) 08��� ���� %1� &��� �" window.location property &�&+�� ���F। ) �&9� 6�&�"� 08��� � ��!� ���

+�F।

������� .t� �������� ������� .t� �������� ������� .t� �������� ������� .t� �������� ( Javascr i pt Pr ompt Tut or i al i n Bangl a)( Javascr i pt Pr ompt Tut or i al i n Bangl a)( Javascr i pt Pr ompt Tut or i al i n Bangl a)( Javascr i pt Pr ompt Tut or i al i n Bangl a) � ��� ��� ��� �� ������������: ������������������������ � �� �� �� �

������� %V � &�&+�� &"���! �� ���� 3��। ������� %V � �f'� +2 &�&+�����7(user) +" "1� ��L+ ��� 3�" )

"1�$# �� &�&+�� ��� 3�� 3��� &�&+�����7�(user) &��_$" 0!#�# �" �:�; +&। �$� ��! ���� prompt � &�&+�� ���� �$F ����! personal webpage !�� ��K��� ��� +"�। "��6� "1� � ��� 6��6!�� 0��&��! ���� ���� +"� �3�!: "Welcome to My Personal WebPage ferdous alam!" ( ��! �6�! �3!�� ��&! "� %��'�" +&)

������� %V �#& ��� �$ !� � 0!�� ��F �&��_ ��। "& �'��� �!� ��! �'�&�।

9�n��-9�n��-9�n��-9�n��- JAVASCRI PT PROMPT:JAVASCRI PT PROMPT:JAVASCRI PT PROMPT:JAVASCRI PT PROMPT: 01.<head> 02.<script type="text/javascript"> 03.<!-- 04.function prompter() { 05.var reply = prompt("Hey there, good looking stranger! What's your name?", "") 06.alert ( "Nice to see you around these parts " + reply + "!") 07.} 08.//--> 09.</script> 10.</head> 11.<body> 12.<input type="button" onclick="prompter()" value="Say my name!"> 13.</body>

%�'�!%�'�!%�'�!%�'�!:

Page 24: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

"& "1� ��L+ ���� �&�� �� �6�� +2 )�� � ��� � &�&+�� ।

������� �.?� E�[\- �������� ������� �.?� E�[\- �������� ������� �.?� E�[\- �������� ������� �.?� E�[\- �������� ( Javascr i pt Pr i nt Funct i on Tut or i al ( Javascr i pt Pr i nt Funct i on Tut or i al ( Javascr i pt Pr i nt Funct i on Tut or i al ( Javascr i pt Pr i nt Funct i on Tut or i al i n Bangl a)i n Bangl a)i n Bangl a)i n Bangl a) � ��� ��� ��� �� ������������: ������������������������ � �� �� �� �

JavaScript print ���'!� �) ��� �� �3�!� �� �6!�� /����� �)=�� ��) ��!#� print 06'!� । JavaScript

print ���'! � 4�&6� � �!- �� &�&+�����7�(user)�%-�� 6�h� ���। 0!� ) ���'!�� 0!1�� �! ��।0!� �F 3��� ��V��� �CD �� 3�! !� "��� �GH ) 06'!� 1�� 0!� �#�&8�

+&।

JAVASCRI PT PRI NT SCRJAVASCRI PT PRI NT SCRJAVASCRI PT PRI NT SCRJAVASCRI PT PRI NT SCRI PT I PT I PT I PT ---- WI NDOW. PRI NT( ) :WI NDOW. PRI NT( ) :WI NDOW. PRI NT( ) :WI NDOW. PRI NT( ) :

JavaScript print function 3� window.print() � 4�&6� �� �%- �� )। ���'!�� )�� � &�! ���&�

3� onClick event � ��8�� ��� ��&। view source print? 1.<form> 2.<input type="button" value="Print This Page" onClick="window.print()" /> 3.</form>

%�'�!%�'�!%�'�!%�'�!:

������� ,�-������� ,�-������� ,�-������� ,�-::::�-PR\�-PR\�-PR\�-PR\ $� ��1�>�d �������� $� ��1�>�d �������� $� ��1�>�d �������� $� ��1�>�d �������� ( Javascr i pt Redi r ect Tut or i al ( Javascr i pt Redi r ect Tut or i al ( Javascr i pt Redi r ect Tut or i al ( Javascr i pt Redi r ect Tut or i al i n Bangl a)i n Bangl a)i n Bangl a)i n Bangl a) � ��� ��� ��� �� ������������: ������������������������ � �� �� �� � 8�#! �6�! �6!�� ��)�� ���! !"#! �.��)! !�� �!" ��2!। ��) �.��)! ���� ��� ��I ��I � %���! +" 6�� �3�6�! �� �6�� � ��'! 6��&"� ! ��&! 01���Z ���� �� �� �6�� � ��'! 6��&"�! ��&!। �& &��6�� JavaScript

redirect �6!�� ��+�3� ��&। 3�! �6!�� 4�&6�� � ���!� +& "�! ) 6��&"� !� &�&+�����7� ����" ��)" 6��!। ��GH �� �6�� +2 6#��"!

location �6� redirect ��� 01���Z 6i!:�!��' ��� । "��6� ��F# ���� &�&8�! &�&+�����7 !"# ! 0&[�! � ���" 6�&।

JavaScript redirect � ��8�� �6�! �& ��" 6��!।

JAVASCRI PT WI NDOW. LOJAVASCRI PT WI NDOW. LOJAVASCRI PT WI NDOW. LOJAVASCRI PT WI NDOW. LOCATI ON:CATI ON:CATI ON:CATI ON:

Page 25: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

���! �6�� � �. +& JavaScript property window.location � ��+�3� �!�s! ��� 3��। window.location "��6�"=" ��e &� "��6� !"# ! URL �� �� �6!�� &"���! �6� �1� �!���; �6� �3" 6��!। �6�! 3�� ��! �� &�&+�����7

�6!�� ��) �t���� ��1 ��1 redirect +�www.google.com � � "& �!�� ���.� � �#!। 1.<script type="text/javascript"> 2.<!-- 3.window.location = " http://www.google.com/ " 4.//--> 5.</script>

JAVASCRI PT TI ME DELAJAVASCRI PT TI ME DELAJAVASCRI PT TI ME DELAJAVASCRI PT TI ME DELAYYYY

� �!��_ 6���[�"" �&' �6���7। N.3�� ���! �6�� � ��'! 6��&"� ! ��! "�+ "Update your bookmarks " 8�!� �� ���� ����� !"# ! � ��'!

�!� �3" 6��!।

O.�!���; ��� 6� 6� 3�� �6�! �6!�� 4�&��) ���' ��" ��!।

�!�� ���+�! � ���" �,� �� tizag.com � �� �6� �!� 3�&।01���Z !"#! �6�� � ��'! tizag.com � � �6��। 01.<html> 02.<head> 03.<script type="text/javascript"> 04.<!-- 05.function delayer(){ 06.window.location = "../javascriptredirect.php" 07.} 08.//--> 09.</script> 10.</head> 11.<body onLoad="setTimeout('delayer()', 5000)"> 12.<h2>Prepare to be redirected!</h2> 13.<p>This page is a time delay redirect, please up date your bookmarks to our new 14.location!</p> 15. 16.</body> 17.</html>

%�'�!:

Time Delay Redirect

Time Delay 01���Z ��F# ��� ���� । � �6" ���� JavaScript � setTimeout function � 0&'�) &�&+�� ��&�।

3�� function delayer() � R ���= (Rccc ��� ��=) ����" ��� ���" ��) ��GH ���� setTimeout �� ��&� 3��

�#� �&9� ��F।

NNNN. 'delayer()' – ���� ��) setTimeout()function � �!���; ���� 6� �3! ��� 6��!" +�।

OOOO. 5000 - ��� ��=� ����� । ���� ��) function delayer() � ��� 6��!" +�� �$

Page 26: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

setTimeout() function � 5000 - ��� ��= ���� ��#�।

WEB PAGE REDI RECTI ONWEB PAGE REDI RECTI ONWEB PAGE REDI RECTI ONWEB PAGE REDI RECTI ON:::: 3�! �6�! 4�&��)� � URL 6��&"�! ��" ��! &� ��) � !"# ! location/0&[�! ���" ��! ��GH JavaScript redirect &�&+�� ��� 3��। 3�� �! +� ��8��! HTML hyperlink � ��8�� �6� &� URL ���� ��� 3�� "&

JavaScript redirect &�&+�� ��� ���" !� ।

������� ������� ������� ������� ,, +, >?1� �������� ,, +, >?1� �������� ,, +, >?1� �������� ,, +, >?1� �������� ( Javascr i pt Popup Wi ndow Tut or i al ( Javascr i pt Popup Wi ndow Tut or i al ( Javascr i pt Popup Wi ndow Tut or i al ( Javascr i pt Popup Wi ndow Tut or i al i n Bangl a)i n Bangl a)i n Bangl a)i n Bangl a) � ��� ��� ��� �� ������������: ������������������������ � �� �� �� �

08��� ���� �'�&� ����& ��) 66�6 �"�7 ��� 3��। ���� �3�& ���$�� ����� ���& ���$�� �!� 66�6 �)=� �"�7��&� ���! 031� 66�6 �)=� &�&+�����7�� �&��_� ���! +&। 3�� �6�! 0�"��_ "1� ��" ��! &� �6�! ���! !"# !

window 46! ��! 3� )�� � !�� ��$ (hyperlink) !�।�GH popup window &�&+����� ���"। JavaScript window.open Function:

)�� � !�� ��$ � &�&+�� F�a�) ���� window.open() function �� ��+�3� !"# ! browser window �"�7

��" 6���। ����� �� function �"�7 ��" 3� window.open() function �� &�&+�� ��। 01.<sup><head> 02.<script type="text/javascript"> 03.<!-- 04.function myPopup() { 05.window.open( " http://www.google.com/ " ) 06.} 07.//--> 08.</script> 09.</head> 10.<body> 11.<form> 12.<input type="button" onClick="myPopup()" value="POP!"> 13.</form> 14.<p onClick="myPopup()">CLICK ME TOO!</p> 15.</body> 16.</sup>

%�'�!%�'�!%�'�!%�'�!:

CLICK ME TOO!

JavaScript Window.Open Arguments:

window.open() function �� ��8�� ���� popup window �� customize ��" 6���। window.open

function �"! 8�!� 3#�_ ��F।

Page 27: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

N webpage � URL 46! ��" ।

O window � text � !��� �!� �!�।

P �� C� string 3� window � ��W properties 8��! ��।

window � !����! �� $#�#E6#!� �&9� 3�� �6�! �� ������� � ��+�8� 6���� !� ��" ��!। 3�+�� ) �#3�$ )

08��� �!) । ���� ��! � �&��W properties �CD � ��6�" ��&�। �!� $#�#E6#!� � ��!� ��� + �।

NNNN dependent – 3�� �6!�� browser window � &D +� "& Subwindow � &D +&।

OOOO fullscreen - fullscreen mode browser %��'�" +4��।

PPPP height – !"# ! window � height, pixels – ।

QQQQ width - !"#! window � width, pixels- ।

RRRR left - screen � &��6�' +" Pixel offset।

SSSS top - screen � �6� +" Pixel offset । TTTT resizable – &�&+�����7� window resize ���� 0!#��" ���� &� &�&+�����7� window resize ��� �1� �&�"

����।

XXXX status - status bar %�'�! ��� &� !� ���।

Dependent, fullscreen, resizable, &� status �&$# � ON/OFF properties � ���+�!। �6�! "���� 'i!� ��

�� &D ��" 6��! &� � �� �� 0! ��" 6��!। �& ) �#) ���� � ��I �� 0!� ���! ���� �!)।

w& ������� w& ������� w& ������� w& ������� ,,+, >?1�,,+, >?1�,,+, >?1�,,+, >?1�:::: 01.<head> 02.<script type="text/javascript"> 03.<!-- 04.function myPopup2() { 05.window.open( " http://www.google.com/ ", "myWindow", 06."status = 1, height = 300, width = 300, resizabl e = 0" ) 07.} 08.//--> 09.</script> 10.</head> 11.<body> 12.<form> 13.<input type="button" onClick="myPopup2()" value="POP2!">

Page 28: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

14.</form> 15.<p onClick="myPopup2()">CLICK ME TOO!</p> 16.</body>

%�'�!%�'�!%�'�!%�'�!:

CLICK ME TOO!

���������������������������� &���%&���%&���%&���% �������� �������� �������� �������� ( Javascr i pt ( Javascr i pt ( Javascr i pt ( Javascr i pt Dat e Tut or i al i n Bangl a)Dat e Tut or i al i n Bangl a)Dat e Tut or i al i n Bangl a)Dat e Tut or i al i n Bangl a)

� ��� ��� ��� �� ������������: ������������������������ � �� �� �� �

Date object �#&) $#�#E6#!� 3�! �6�! "���� %�'�! ��" ��! 01&� � %��� calculation � �GH timestamp &�&+��

���� ���। ������� &�&+�����7� computer clock 0!#3��7 Date object �"�7 ��� +�। 3�! Date object �"�7 ��� +� ��V��� � 0�?�7! ��� 0!#3��7 "�! � �#&) $#�#E6#!� 3�� ��� ��� &D �� ��� &� ���3�� ��W time zone 0&[�! ��

������� &���% ������� &���% ������� &���% ������� &���% ((((+��� $&R��- 9��+��� $&R��- 9��+��� $&R��- 9��+��� $&R��- 9��) :) :) :) : ����� ������� Date object � �G"� &�a�" �+� ��F# ��� ���"। �6�! 3�� Date constructor (�3 Date object

�"�7 �� ) �� ���! 3#�_ &� '"� !� ��! "& � &�&+�����7� computer clock 0!#3��7 Date object �"�7 ��&। 1.<h4>It is now

2.<script type="text/javascript">

3.<!--

4.var currentTime = new Date()

5.//-->

6.</script>

7.</h4>

%�'�!%�'�!%�'�!%�'�!:

I t i s nowI t i s nowI t i s nowI t i s now

���! ��� %�'�! ��F !� ���! ���� Date object � ���! 6u�" 0& C! ���!।

������� 9��������� 9��������� 9��������� 9��:::: Date object �"�7 +�F &� ����� �����& ��F 3� &"���! "����� 8��! ��। "1� 6�4��� �!� 3� ���� %�'�! ��&

���!� ���� ��F# ���'! &�&+�� ��&। �!� �r� ��� + �।

Page 29: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

NNNN. getTime() – ��� ��= $d!� since N/N/NjTc @ NO:cc am

OOOO. getSeconds() – ���= $d!� (c-Rj)

PPPP. getMinutes() – ���! $d!� (c-Rj)

QQQQ. getHours() – �-� $d!� (c-OP)

RRRR. getDay() – �l�+� ��! $d!� (c-S). c=��&&��, ... , S= '�!&��

SSSS. getDate() – ���� ��! $d!� (c-PN)

TTTT. getMonth() – ��� $d!� (c-NN)

XXXX. getFullYear() – ��� �.��� &F� (NjTc-jjjj)

�! "���� �&9�� "1� %�'�! ��" 6��&�। �!�� ���+�! ���� getDate, getMonth, &�getFullYear ���'! &�&+��

���F। 01.<h4>It is now

02.<script type="text/javascript">

03.<!--

04.var currentTime = new Date()

05.var month = currentTime.getMonth() + 1

06.var day = currentTime.getDate()

07.var year = currentTime.getFullYear()

08.document.write(month + "/" + day + "/" + year)

09.//-->

10.</script>

11.</h4>

%�'�!%�'�!%�'�!%�'�!:

I t i s nowI t i s nowI t i s nowI t i s now

G� ��#! �3 month variable (currentTime.getMonth() + 1) � ��1 N �3�$ ��� +�F । �3+"# ��!#���7 ��� c &��.�C� ��� NN !C� "�) ) ����� ���8�! ��" month variable � ��1 N �3�$ ��� +�F । N �3�$ ���� 6� ��!#���7 ���N &� �.�C� ��� NO !C� +�F।

������� ������� ������� ������� (((($&R��-$&R��-$&R��-$&R��-) ) ) ) 9�� x��9�� x��9�� x��9�� x��:::: ���� �! Date %�'�! ���� 6��&"� �! �� ��� %�'�! ��&� 3� �.��� ��a" ���� 3��। HH:MM AM/PM (H

= �-� , M =���! )।

Page 30: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

01.<h4>It is now

02.<script type="text/javascript">

03.<!--

04.var currentTime = new Date()

05.var hours = currentTime.getHours()

06.var minutes = currentTime.getMinutes()

07.if (minutes < 10){

08.minutes = "0" + minutes

09.}

10.document.write(hours + ":" + minutes + " ")

11.if(hours > 11){

12.document.write("PM")

13.} else {

14.document.write("AM")

15.}

16.//-->

17.</script>

18.</h4>

%�'�!%�'�!%�'�!%�'�!:

I t i s nowI t i s nowI t i s nowI t i s now

3�� hours or minutes variable 10 +" �� +� "& T X j )"���� "& ) ������ ���! 'i!� &��!� �� 01���Z cT, cX,

cj )"���। 3�� ��� +� N:cN am "& N:N am � � �� ����� !�।

������� E�R 0�� 1\- ������� E�R 0�� 1\- ������� E�R 0�� 1\- ������� E�R 0�� 1\- ( JavaScr i pt For m Val i dat i on Tut or i al i n ( JavaScr i pt For m Val i dat i on Tut or i al i n ( JavaScr i pt For m Val i dat i on Tut or i al i n ( JavaScr i pt For m Val i dat i on Tut or i al i n Bangl a)Bangl a)Bangl a)Bangl a) � ��� ��� ��� �� ������������: ���4��!# ���4��!# ���4��!# ���4��!# � �� �� �� �

Order L+! ���,guestbook entry ���, &� 0!��!� �.� �3$#� ���� ��8�� ��&�� ��, ��! )���� 3�� $#� 0�V#!� ��

Page 31: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

��&�� �� "�+ � ��� &a I�� � �� ��F# �!)। ������� � ��8�� �& I�� � a�" 6��!। ) ���' � & � +� "���

��� .'!"। ������� ��� ��� .'! �! �� ���' 3�� ��8�� &�&+�����7$! �.� ��&�� ���� �$ "�� ��� � "1�� 3���)��।������� �6!�� ��+�3����7 �� ����& &� ��� &�&+�����7$!� ��!�& �3 "�� "1�� �# &� 0�V#!� �F &� ��4& & �3 ����& �� ������ ���8�! ��" 6��&। 08��� ���� ��F# �&��� ��� ��� .'! �!� � ��!� ��&�। �!�� �&9�

$# �� ���� ����& 3���) ��& "� 8�6 8�6 � ��!� ��� +�F।

N. �� text input � ��� !��� ��� !�।

O.3�� text input � �& ������ +�।

P.3�� text input � �& &d�� +�।

Q. 3�� text input � �& alphanumeric character (numbers &� letters) � +�। R.3�� text input �" �h� ������ character 1��। �&9�� ����� 3�! username &� password � length ��

restriction ���� 1�� 01���Z "� �!���; ����� &� &d�� �&�' +& !�। T.)�) <� � �&8 ��!�

)"���� ����� �!� ��� ��� .'! &�&�" +�।

E�R E�R E�R E�R 0�� 1\- 0�� 1\- 0�� 1\- 0�� 1\- ::::NONNONNONNON---- EMPTY EMPTY EMPTY EMPTY 06� ���06� ���06� ���06� ���::::

� �� common �)6� ��� ��� .'! । �6�! �!�Y" +" 6��&! �3 &�&+�����7 )�� � ��� � �8� �.� � �F

��!�। )�� � )!6# � ��� !��� ��� !� �& �!d��� �!� �!� �&��� ������� ���. � �� + �। 01.// If the length of the element's string is 0 th en display helper message 02.function notEmpty(elem, helperMsg){ 03.if(elem.value.length == 0){ 04.alert(helperMsg); 05.elem.focus(); // set the focus to this input 06.return false; 07.} 08.return true; 09.}

notEmpty function � ��� �� ��� �3 )�� � input � �3 � ��� ���� 6�A�&� ����! ��F# �F ��!�। elem +

HTML text input ���� ) ���'!� 6�A�&� । ������� strings � built in property ��F। "�� �8� �� +

length property । 3� string � length �� return ��। �� &a ���. elem.value 3� input � ��"� string ��

�� ���। ���.� ��� length 3#_ +�। �'9 ��a�� elem.value.length । elem.value.length 3�� 'i!� !� +� &� ��� !� +� "& ���� �"� & ��� 6�)। 0!�1� helperMsg � ��+�3�

&�&+�����7� ���! �� alert ���� %���'" +� । ���1�� &�&+�����7� �# +�F ) ����� "� �!��' ��। � ��1�� �+��&

Page 32: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

��� 6�4�� 3��। ���+�!: 01.<script type='text/javascript'> 02.function notEmpty(elem, helperMsg){ 03.if(elem.value.length == 0){ 04.alert(helperMsg); 05.elem.focus(); 06.return false; 07.} 08.return true; 09.} 10.</script> 11.<form> 12.Required Field: <input type='text' id='req1'/> 13.<input type='button' 14.onclick="notEmpty(document.getElementById('req1' ), 'Please Enter a Value')" 15.value='Check Field' /> 16.</form>

%�'�!:

Required Field:

E�R 0�� 1\- E�R 0�� 1\- E�R 0�� 1\- E�R 0�� 1\- ---- 9$ >-,a� 9[%f� ��-�9$ >-,a� 9[%f� ��-�9$ >-,a� 9[%f� ��-�9$ >-,a� 9[%f� ��-� &� 06� ���� �y&� 06� ���� �y&� 06� ���� �y&� 06� ���� �y:::: 3�� ��� �U�. ��.� ,���! !C�, zip ���. )"���� )!6# �M � � "& �6!�� ���.� ��8�� �!�Y" ��" +& �3 )!6# �M�+& ������। �& ��� ���� �" �6�� +2 3�� input � string �� # +� �& ������ 3�� regular expression +2 /^[0-

9]+$/ &� "� match ��& 3�� string +� �& ������ �� "� 0?"6G � character � +�। 01.// If the element's string matches the regular e xpression it is all numbers 02.function isNumeric(elem, helperMsg){ 03.var numericExpression = /^[0-9]+$/; 04.if(elem.value.match(numericExpression)){ 05.return true; 06.}else{ 07.alert(helperMsg); 08.elem.focus(); 09.return false; 10.} 11.}

�6�� ���.� ��"� %"��� string + �� function 3�� !�� match । ) function � &�&+�� �� ���" 6��! �3

string � ��1 match ��F ��!�। ���� �� ��& &�&+�� ��" 6��� �3�!:

elem.value.match( ��! expression)

Page 33: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

���� 3�� ���" ��) �3 )!6#� string � �& ����� �F ��!�, ��GH ���� ����� ��� ���� �!� regular expression �"�7

���F 3� numericExpression �+��& ��� ���। ���� regular expression � ��+" match function &�&+�� ���F। 3�� � numeric +� 1��

"&match function � �"� & ��� 6�&। ����� isNumeric function �4 �"� & ��� 6�&। 3�� )!6# string �

&d� &� 0!� characters +� "& ����� expression � &�1� +&। � helperMsg � %��'�" +& &� ��1�� & �� 6�&। ���+�!: 01.<script type='text/javascript'> 02.function isNumeric(elem, helperMsg){ 03.var numericExpression = /^[0-9]+$/; 04.if(elem.value.match(numericExpression)){ 05.return true; 06.}else{ 07.alert(helperMsg); 08.elem.focus(); 09.return false; 10.} 11.} 12.</script> 13.<form> 14.Numbers Only: <input type='text' id='numbers'/> 15.<input type='button' 16.onclick="isNumeric(document.getElementById('numb ers'), 'Numbers Only Please')" 17.value='Check Field' /> 18.</form>

%�'�!%�'�!%�'�!%�'�!:

Numbers Only:

E�R 0�� 1\- E�R 0�� 1\- E�R 0�� 1\- E�R 0�� 1\- ---- 9� >-,a� 9� >-,a� 9� >-,a� 9� >-,a� $zR �� -� &� 06� ���$zR �� -� &� 06� ���$zR �� -� &� 06� ���$zR �� -� &� 06� ���� �y� �y� �y� �y:::: ) isAlphabet function � isNumeric function � �" "& &��"U� '#8#��H regular expression 6��&"� !�

�GH। ���� ��"� match function � &�&+�� ���F । ��! ���� ����� ��� ���� 6��&"� &d� ��� ��&�। ���� 3��

���" ��) ����� string � '#8# &d� 8��! ��&, "& ���� lowercase &� uppercase ���� �GH expression �!���;

�� ��&। 01.// If the element's string matches the regular e xpression it is all letters 02.function isAlphabet(elem, helperMsg){ 03.var alphaExp = /^[a-zA-Z]+$/; 04.if(elem.value.match(alphaExp)){ 05.return true; 06.}else{ 07.alert(helperMsg); 08.elem.focus(); 09.return false; 10.}

Page 34: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

11.}

���+�!: 01.<script type='text/javascript'> 02.function isAlphabet(elem, helperMsg){ 03.var alphaExp = /^[a-zA-Z]+$/; 04.if(elem.value.match(alphaExp)){ 05.return true; 06.}else{ 07.alert(helperMsg); 08.elem.focus(); 09.return false; 10.} 11.} 12.</script> 13.<form> 14.Letters Only: <input type='text' id='letters'/> 15.<input type='button' 16.onclick="isAlphabet(document.getElementById('let ters'), 'Letters Only Please')" 17.value='Check Field' /> 18.</form>

%�'�!%�'�!%�'�!%�'�!:

Letters Only:

E�R 0�� 1\- E�R 0�� 1\- E�R 0�� 1\- E�R 0�� 1\- ---- 9� $zR @$[ 9[%f� 9� $zR @$[ 9[%f� 9� $zR @$[ 9[%f� 9� $zR @$[ 9[%f� 06� ���� �y06� ���� �y06� ���� �y06� ���� �y:::: ���� isAlphabet &� isNumeric function ��� �� �H �� �� function �#6�?��" ���F 3� `��� ����

)!6#� &d� 4 ����� ���� ��� ��" 6���। �3�!: isAlphanumeric 01.// If the element's string matches the regular e xpression it is numbers and letters 02.function isAlphanumeric(elem, helperMsg){ 03.var alphaExp = /^[0-9a-zA-Z]+$/; 04.if(elem.value.match(alphaExp)){ 05.return true; 06.}else{ 07.alert(helperMsg); 08.elem.focus(); 09.return false; 10.} 11.}

E�R 0�� 1\- E�R 0�� 1\- E�R 0�� 1\- E�R 0�� 1\- ---- CHARACTER CHARACTER CHARACTER CHARACTER @� pPxRf $� @� pPxRf $� @� pPxRf $� @� pPxRf $� LENGTH LENGTH LENGTH LENGTH @� �$�n�-mn@� �$�n�-mn@� �$�n�-mn@� �$�n�-mn:::: Character !C�� �&�8�!98 ����� &�&+�����7 �+� field %&' ��" 6��& � 0%����� �.� %�"��8 ��� 3��। �3�!�6�! ��!! �3 zip ���. R ������ +4�� ���" ��GH O ������ +4�� ���" !�। �!� ����lengthRestriction function ��"�7 ���F ����! ���� �#� ������ ��8�� �M �.� )!6# ���� �!� minimum &� maximum Character � �����

�!8���! �� ����F।

Page 35: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

01.function lengthRestriction(elem, min, max){ 02.var uInput = elem.value; 03.if(uInput.length >= min && uInput.length <= max) { 04.return true; 05.}else{ 06.alert("Please enter between " +min+ " and " +max + " characters"); 07.elem.focus(); 08.return false; 09.} 10.}

���+�!: 01.<script type='text/javascript'> 02.function lengthRestriction(elem, min, max){ 03.var uInput = elem.value; 04.if(uInput.length >= min && uInput.length <= max) { 05.return true; 06.}else{ 07.alert("Please enter between " +min+ " and " +max+ " characters"); 08.elem.focus(); 09.return false; 10.} 11.} 12.</script> 13.<form> 14.Username(6-8 characters): <input type='text' id='restrict'/> 15.<input type='button' 16.onclick="lengthRestriction(document.getElementBy Id('restrict'), 6, 8)" 17.value='Check Field' /> 18.</form>

%�'�!%�'�!%�'�!%�'�!:

Username(6-8 characters):

E�R 0�� 1\- E�R 0�� 1\- E�R 0�� 1\- E�R 0�� 1\- ---- SELECTION SELECTION SELECTION SELECTION p&�W p&�W p&�W p&�W ������������:::: ��! madeSelection function � &�&+�� ��� +�F। &�&+�����7 )�� � select input +" �3��! �&9� select ��" 6��&!। �6�! ��8��! trick �+��& &�&+�����7� �!� %1� 06'! �� ��+�3����7 prompt �+��& ���" 6��!। %1�

06'! �+��& select input- ��F# ���" 6��! �3�!: "Please Choose" । 01.function madeSelection(elem, helperMsg){ 02.if(elem.value == "Please Choose"){ 03.alert(helperMsg); 04.elem.focus(); 05.return false; 06.}else{ 07.return true; 08.} 09.}

Page 36: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

���+�!: 01.<script type='text/javascript'> 02.function madeSelection(elem, helperMsg){ 03.if(elem.value == "Please Choose"){ 04.alert(helperMsg); 05.elem.focus(); 06.return false; 07.}else{ 08.return true; 09.} 10.} 11.</script> 12.<form> 13.Selection: <select id='selection'> 14.<option>Please Choose</option> 15.<option>CA</option> 16.<option>WI</option> 17.<option>XX</option> 18.</select> 19.<input type='button' 20.onclick="madeSelection(document.getElementById(' selection'), 'Please Choose Something')" 21.value='Check Field' /> 22.</form>

%�'�!%�'�!%�'�!%�'�!:

Selection:

E�R 0�� 1\- E�R 0�� 1\- E�R 0�� 1\- E�R 0�� 1\- – >�> 0�� 1\->�> 0�� 1\->�> 0�� 1\->�> 0�� 1\-::::

�! �6!��� ����&� �3, &�&+�����7� )�) � �&8 ��!� "� ����& �6�! ��� ��" 6��&! । 0&'�) )�) 0?"6G @ sign &� dot (.) 1��& �3��! @ sign � )�) � %1� Character +& !� &� �'9� dot

(.) � @ sign � 6� 0&'�) � Character � +&।

Valid ���+�!:

[email protected]

Invalid ���+�!:

• @deleted.net - @ sign � �$ ���! characters �!)। • [email protected] - invalid character !

• shoes@need_shining.com - domain name underscores &�&e" +� !�। 01.function emailValidator(elem, helperMsg){ 02.var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z 0-9]{2,4}$/; 03.if(elem.value.match(emailExp)){

Page 37: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

04.return true; 05.}else{ 06.alert(helperMsg); 07.elem.focus(); 08.return false; 09.} 10.}

���+�!: 01.<script type='text/javascript'> 02.function emailValidator(elem, helperMsg){ 03.var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z 0-9]{2,4}$/; 04.if(elem.value.match(emailExp)){ 05.return true; 06.}else{ 07.alert(helperMsg); 08.elem.focus(); 09.return false; 10.} 11.} 12.</script> 13.<form> 14.Email: <input type='text' id='emailer'/> 15.<input type='button' 16.onclick="emailValidator1(document.getElementById ('emailer'), 'Not a Valid Email')" 17.value='Check Field' /> 18.</form>

%�'�!%�'�!%�'�!%�'�!:

Email:

E�R 0�� 1\- E�R 0�� 1\- E�R 0�� 1\- E�R 0�� 1\- – 9$ @� �a{&R9$ @� �a{&R9$ @� �a{&R9$ @� �a{&R::::

%"�� ��� � ������� event ��F 3�� !�� onSubmit । � ��� �� 3�! � ��&�� &�! �,� ��� +�। 3�� ) event

� c &� ��1�� return �� "& ��� � ��&�� +& !�। 3�� � N &� �"� & return �� "& ��� ��&�� +&। ��� ��&�� �

�GH ��! ���Validator ���'!� &�&e" +�F।

)�� � ��� ���.:

01.<form onsubmit='return formValidator()' > 02.First Name: <input type='text' id='firstname' /><br /> 03.Address: <input type='text' id='addr' /><br /> 04.Zip Code: <input type='text' id='zip' /><br /> 05.State: <select id='state'> 06.<option>Please Choose</option> 07.<option>AL</option>

Page 38: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

08.<option>CA</option> 09.<option>TX</option> 10.<option>WI</option> 11.</select><br /> 12.Username(6-8 characters): <input type='text' id='username' /><br /> 13.Email: <input type='text' id='email' /><br /> 14.<input type='submit' value='Check Form' /><br /> 15.</form> 01.function formValidator(){ 02.// Make quick references to our fields 03.var firstname = document.getElementById('firstname'); 04.var addr = document.getElementById('addr'); 05.var zip = document.getElementById('zip'); 06.var state = document.getElementById('state'); 07.var username = document.getElementById('username'); 08.var email = document.getElementById('email'); 09. 10.// Check each input in the order that it appears in the form! 11.if(isAlphabet(firstname, "Please enter only lett ers for your name")){ 12.if(isAlphanumeric(addr, "Numbers and Letters Onl y for Address")){ 13.if(isNumeric(zip, "Please enter a valid zip code ")){ 14.if(madeSelection(state, "Please Choose a State") ){ 15.if(lengthRestriction(username, 6, 8)){ 16.if(emailValidator(email,"Please enter a valid em ail address")){ 17.return true; 18.} 19.} 20.} 21.} 22.} 23.} 24. 25. 26.return false; 27. 28.}

������������ ��� .'!��� .'!��� .'!��� .'!- �! �! �! �! �&�&�&�& �H �H �H �H:

�!� )�� � ��� ���. &� !"# ! ��� Validator function �"�7 ���F । ) 08��� � ���" 0!��!� ��� ��� .'! �

6u�"� ��H" ��� +�F । )�� � &� ������� ���.: 001.<script type='text/javascript'> 002. 003.function formValidator(){ 004.// Make quick references to our fields 005.var firstname = document.getElementById('firstname'); 006.var addr = document.getElementById('addr'); 007.var zip = document.getElementById('zip');

Page 39: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

008.var state = document.getElementById('state'); 009.var username = document.getElementById('username'); 010.var email = document.getElementById('email'); 011. 012.// Check each input in the order that it appear s in the form! 013.if(isAlphabet(firstname, "Please enter only let ters for your name")){ 014.if(isAlphanumeric(addr, "Numbers and Letters On ly for Address")){ 015.if(isNumeric(zip, "Please enter a valid zip cod e")){ 016.if(madeSelection(state, "Please Choose a State" )){ 017.if(lengthRestriction(username, 6, 8)){ 018.if(emailValidator(email,"Please enter a valid e mail address")){ 019.return true; 020.} 021.} 022.} 023.} 024.} 025.} 026. 027. 028.return false; 029. 030.} 031. 032.function notEmpty(elem, helperMsg){ 033.if(elem.value.length == 0){ 034.alert(helperMsg); 035.elem.focus(); // set the focus to this input 036.return false; 037.} 038.return true; 039.} 040. 041.function isNumeric(elem, helperMsg){ 042.var numericExpression = /^[0-9]+$/; 043.if(elem.value.match(numericExpression)){ 044.return true; 045.}else{ 046.alert(helperMsg); 047.elem.focus(); 048.return false; 049.} 050.} 051. 052.function isAlphabet(elem, helperMsg){ 053.var alphaExp = /^[a-zA-Z]+$/; 054.if(elem.value.match(alphaExp)){ 055.return true; 056.}else{ 057.alert(helperMsg); 058.elem.focus();

Page 40: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

059.return false; 060.} 061.} 062. 063.function isAlphanumeric(elem, helperMsg){ 064.var alphaExp = /^[0-9a-zA-Z]+$/; 065.if(elem.value.match(alphaExp)){ 066.return true; 067.}else{ 068.alert(helperMsg); 069.elem.focus(); 070.return false; 071.} 072.} 073. 074.function lengthRestriction(elem, min, max){ 075.var uInput = elem.value; 076.if(uInput.length >= min && uInput.length <= max ){ 077.return true; 078.}else{ 079.alert("Please enter between " +min+ " and " +max+ " characters"); 080.elem.focus(); 081.return false; 082.} 083.} 084. 085.function madeSelection(elem, helperMsg){ 086.if(elem.value == "Please Choose"){ 087.alert(helperMsg); 088.elem.focus(); 089.return false; 090.}else{ 091.return true; 092.} 093.} 094. 095.function emailValidator(elem, helperMsg){ 096.var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z 0-9]{2,4}$/; 097.if(elem.value.match(emailExp)){ 098.return true; 099.}else{ 100.alert(helperMsg); 101.elem.focus(); 102.return false; 103.} 104.} 105.</script> 106. 107.<form onsubmit='return formValidator()' > 108.First Name: <input type='text' id='firstname' /><br />

Page 41: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

109.Address: <input type='text' id='addr' /><br /> 110.Zip Code: <input type='text' id='zip' /><br /> 111.State: <select id='state'> 112.<option>Please Choose</option> 113.<option>AL</option> 114.<option>CA</option> 115.<option>TX</option> 116.<option>WI</option> 117.</select><br /> 118.Username(6-8 characters): <input type='text' id='username' /><br /> 119.Email: <input type='text' id='email' /><br /> 120.<input type='submit' value='Check Form' /> 121.</form>

%�'�!%�'�!%�'�!%�'�!:

First Name:

Address:

Zip Code:

State:

Username(6-8 characters):

Email: Check Form

���������������������������� �|[�|[�|[�|[ E�[\-E�[\-E�[\-E�[\- ( JavaScr i pt St r i ng Funct i ons Tut or i al i n ( JavaScr i pt St r i ng Funct i ons Tut or i al i n ( JavaScr i pt St r i ng Funct i ons Tut or i al i n ( JavaScr i pt St r i ng Funct i ons Tut or i al i n Bangl a)Bangl a)Bangl a)Bangl a)

� ��� ��� ��� �� ������������: ���4��!# ���4��!# ���4��!# ���4��!# � �� �� �� �

� �6!�� ��F 6#��"! �! +" 6�� "& ��"� %"�� ������� ��� + ��"6� ���'! 3� �6!�� ��'U� ���� 06G��

1��। � ���! +2 �������- ��� �i " � $#2 property &� function(3�� method 4 & � +�) �&�'; object ।

PSEUDO PSEUDO PSEUDO PSEUDO ������� 0��1������� 0��1������� 0��1������� 0��1:::: 01.<script>

02.var myString = "Hello Thur!";

03.

Page 42: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

04.//This is how you would access a property

05.var myProperty = myString.property;

06.

07.//This is how you would access a function

08.var myFunctionResult = myString.function(argument1, arg ument2);

09.</script>

�|[ 0.�,���R�|[ 0.�,���R�|[ 0.�,���R�|[ 0.�,���R ��������?( STRI NG PROPERTY)?( STRI NG PROPERTY)?( STRI NG PROPERTY)?( STRI NG PROPERTY) String property +2 3� object �V�� ��F# ���� � "1� ���।3�!: String object � lengthproperty ��F 3�

String- characters � ����� ��� ���।

�|[ E�[\- ���|[ E�[\- ���|[ E�[\- ���|[ E�[\- ��? ( STRI NG FUNCTI ON)? ( STRI NG FUNCTI ON)? ( STRI NG FUNCTI ON)? ( STRI NG FUNCTI ON) �6!�� String �V�� 0!���F# �6" String Function � 0!� �6���7। �3�!: �6�! String Function � ��8��

String �6 ! &� 0!�$# � �= �&�_ �� ! �3��! character $# � �6�! ��&��+ ��F!। � $#�#E6#!� �&9� +2 ) ���'!$#� �i " String �� 6��&"� ! �� !� "& "��� !"# ! String ���!� �� 3� �6�! ��� ���"

6��!।

STRING FUNCTIONS STRING FUNCTIONS STRING FUNCTIONS STRING FUNCTIONS @$[ @$[ @$[ @$[ PROPERTI ES:PROPERTI ES:PROPERTI ES:PROPERTI ES: ) 08��� ����!� +�F ����& �6�! String �� 6���� !�,$d!�,%�"[�6!,��0.� �� &� ���� ��" 6��!। ) advanced

�&9�� �6!�� dynamic 4�& �6� �"�7� �GH !"# ! � �$"� `�� �{��! �� ��& । @�� +,-�� ��i ,a��&- �- '& ,�� &$ ��&� .&f��������string' ��&,� E�[\- r�+,-�� +P\:� ���� F,}�� /��। @� ���- '~�������-@string�� & @�j~property@$[function(r��method� $ � '� )�$�\�object।

Pseudo���������.���������.���������.���������.:

<script type="text/javascript"> var myString = "Hello Thur!"; //This is how you would access a property var myProperty = myString.property ; //This is how you would access a function var myFunctionResult = myString.function(argument1, argument2) ; </script>

Page 43: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

String Property��������? String property'~ r�object9t�R ��ia 0��� � &/f 0P�। 0r�-: String

object@� lengthproperty ��i r�String-@characters@� 9[%f� ��� ��%।

String Function��������?

+,-��String9t�R F-���ia 0,&String Function�� F-� ,���W। 0r�-: +,�-String Function@���nf�String0, - @$[ F-�j � %?1 �$�� �� - 0r%�-characterj � +,�- 9�$��'��i-।

@�� jkl,a-R �$m� '~ @> E�[\-j� �� &String0� ,��$&R- �� -� &$ &��� -&a-String����-R�� r� +,�- ��� ��%& ,��-।

String Functions@$[@$[@$[@$[Properties: @> Fnf�� 0P%�-� '�i ����$ +,�-String0� ,��6� -�, Vz-�, .�&Q�,-, ��F1R�� @$[ 9�6R ��&,��-। @>advanced�$m��� +,-��dynamic��$ 0,� p&�W� 0}� -&a- @� �V&� ��� ��6-�� 0P$ ।

����������������������������String Length:

Advanced scripter0P� .��> ��-�� .���- '� 0rString�� 0��- '$। 0r�- nk- @��-webdeveloper@���submission���p&�W �� � 0r%�-username@� �y �� @� 0$�\character�-nR��- ��� '��-, E &�� �6& '$ $f$'�����W����01�� 9�$��� ��& F���& 0P��� +Vstring@�length 06� �� 0-��।

Page 44: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

String Length Property:

length property�� character@� 9[%f�� ���R�- �� r�String-@ ��i।

���������.���������.���������.���������.:

<script type="text/javascript"> var myString = "123456"; var length = myString.length; document.write("The string is this long: " + length ); // Same thing, but using the property inside the wr ite function document.write("<br />The string is this long: " + myString.length ); </script>

.P\R-.P\R-.P\R-.P\R-::::

String,��$&R-,��$&R-,��$&R-,��$&R- ' ' ' ' Length���� ,��$&R-,��$&R-,��$&R-,��$&R- '$'$'$'$::::

String@ ��ia character0r�V ���� ,� r�P +,�-length property� 0�E��� 0P- &$length property��� ,��$&R- '$।

Page 45: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

���������.���������.���������.���������.:

<script type="text/javascript"> var myString = "123456"; document.write("The string is this long: " + myString.length ); myString = myString + "7890"; document.write("<br />The string is now this long: " + myString.length ); </script>

.P\R-.P\R-.P\R-.P\R-::::

������� �|[ 0 [/ $� pPxRf ������� �|[ 0 [/ $� pPxRf ������� �|[ 0 [/ $� pPxRf ������� �|[ 0 [/ $� pPxRf ( JavaScr i pt St r i ng Lengt h)( JavaScr i pt St r i ng Lengt h)( JavaScr i pt St r i ng Lengt h)( JavaScr i pt St r i ng Lengt h) � ��� ��� ��� �� ������������: ���4��!# ���4��!# ���4��!# ���4��!# � �� �� �� �

������� �|[������� �|[������� �|[������� �|[ 0 [/ $� pPxRf 0 [/ $� pPxRf 0 [/ $� pPxRf 0 [/ $� pPxRf ( JAVASCRI PT STRI NG L( JAVASCRI PT STRI NG L( JAVASCRI PT STRI NG L( JAVASCRI PT STRI NG LENGTH)ENGTH)ENGTH)ENGTH) Advanced scripter ��� %��) ��!�� %���! +� �3 String � ���! +&। �3�! 8�#! ��! 4�& �.� 6�� ��submission ��� �"�7 �� � �3��! )���� �!� � �!� Oc 0G�� � �&�' �!8���! ��� +��!, � "�� ���" +&

&�&+�����7� ��� �.� ��&�� ��" 0!#��" ����� �$ ��� � length ��� �� �!��।

�|[ 0 [/ 0.�,���R�|[ 0 [/ 0.�,���R�|[ 0 [/ 0.�,���R�|[ 0 [/ 0.�,���R ( STRI NG LENGTH PROPE( STRI NG LENGTH PROPE( STRI NG LENGTH PROPE( STRI NG LENGTH PROPERTY)RTY)RTY)RTY)

length property � character � ������ ��� �! �� 3� ���- ��F। 01.<script> 02.var myString = "123456"; 03. 04.var length = myString.length; 05. 06.document.write("The string is this long: " + length); 07. 08.// Same thing, but using the property inside the write function

Page 46: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

09.document.write("<br />The string is this long: " + myString.length); 10. 11.</script>

%�'�!%�'�!%�'�!%�'�!:

The string is this long: 6

The string is this long: 6The string is this long: 6

The string is this long: 6

�|[ ,��$&R- ' �|[ ,��$&R- ' �|[ ,��$&R- ' �|[ ,��$&R- ' LENGTH LENGTH LENGTH LENGTH � ,��$&R- '$� ,��$&R- '$� ,��$&R- '$� ,��$&R- '$:::: ��� ��F# character �3�$ ���� 6� 3�� �6�! length property � ������ ��! "& length property �� 6��&"� !

+&। 1.<script> 2.var myString = "123456"; 3.document.write("The string is this long: " + myString.length); 4. 5.myString = myString + "7890"; 6.document.write("<br />The string is now this long : " + myString.length); 7. 8.</script>

%�'�!%�'�!%�'�!%�'�!:

The string is this long: 6

The string is now this long: 10The string is this long: 6

The string is now this long: 10

������� �|[ ��B� E�[\- ������� �|[ ��B� E�[\- ������� �|[ ��B� E�[\- ������� �|[ ��B� E�[\- ( JavaScr i pt Spl i t Funct i on)( JavaScr i pt Spl i t Funct i on)( JavaScr i pt Spl i t Funct i on)( JavaScr i pt Spl i t Funct i on)� ��� ��� ��� �� ������������: ���4��!# ���4��!# ���4��!# ���4��!# � �� �� �� � ��� �� �&��W # ���" �&�_ ���� G�"� 3� 0!� �%�L���� ���$#�� ��1�! ��। �������4 "� ��।3�� �6!�� 0!� C� ���

�3�!: "Bobby Susan Tracy Jack Phil Yannis" &� %"��� !��� � ��� � ��� ��& ��� ���" 6��!। �6�!

space character " " �� �!��' ��" 6��!। split function � !"# ! #��� �"�7 ��& 3� %"��&�� �~�� G ��।

��B� E�[\- �1� ����B� E�[\- �1� ����B� E�[\- �1� ����B� E�[\- �1� ����� ��� ��� ��� ( SPLI T FUNCTI ON: DEL( SPLI T FUNCTI ON: DEL( SPLI T FUNCTI ON: DEL( SPLI T FUNCTI ON: DELI MI TER)I MI TER)I MI TER)I MI TER) space character " " � +& ����� delimiter &� split function 3� ��� �� �&�_ ��" � &�&+�� ��। %"����� � delimiter �� G �� 3� ���� �!��' ���F। � array �" !"# ! � �- �"�7 ��। split function � %1� 3#�_

+2 delimiter ।

9�n��- ��B� E�[\-9�n��- ��B� E�[\-9�n��- ��B� E�[\-9�n��- ��B� E�[\- @� P�'�-@� P�'�-@� P�'�-@� P�'�-::::

Page 47: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

�!� ������ ��� � ���+�! ���� + �। ��� � �&�_ +� 3�! � R ������� ���। ��! R +2 delimiter । G� ���� �&9�+2 split function � array �� ��� �! �� 3�� mySplitResult ��� ���" 6���। 1.<script> 2.var myString = "123456789"; 3. 4.var mySplitResult = myString.split("5"); 5. 6.document.write("The first element is " + mySplitResult[0]); 7.document.write("<br /> The second element is " + mySplitResult[1]); 8.</script>

%�'�!:

The first element is 1234

The second element is 6789The first element is 1234

The second element is 6789

�6�� ���+�! ���� R �� delimiter �+��& 6FB ���F। "& � ����� � �� !�। ���! delimiter� String +"

�&"��a" +�। 6�&�"� character $# � ��n�� 0�' `��� 6:1� +�।

$� SPLI T FUNCTI ON @�$� SPLI T FUNCTI ON @�$� SPLI T FUNCTI ON @�$� SPLI T FUNCTI ON @� P�'�-P�'�-P�'�-P�'�-:::: �!� ���� split function � ���+�! �"�7 ���F �3��! &�d�" +�F �3 ����& ) ���'!� ��� �� split��। ���� 'i!� +"

���� ��� �"�7 ���F। ) ���+�! delimiter +2 space character " " । 01.<script> 02.var myString = "zero one two three four"; 03. 04.var mySplitResult = myString.split(" "); 05. 06.for(i = 0; i < mySplitResult.length; i++){ 07.document.write("<br /> Element " + i + " = " + mySplitResult[i]); 08.} 09.</script>

%�'�!:

Element 0 = zero

Element 1 = one

Element 2 = two

Element 3 = three

Element 4 = four

Element 0 = zero

Element 1 = one

Page 48: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

Element 2 = two

Element 3 = three

Element 4 = four

������� �|[ ������� �|[ ������� �|[ ������� �|[ F�9��- F�9��- F�9��- F�9��- ( JavaScr i pt St r i ng Sear ch)( JavaScr i pt St r i ng Sear ch)( JavaScr i pt St r i ng Sear ch)( JavaScr i pt St r i ng Sear ch)� ��� ��� ��� �� ������������: ���4��!# ���4��!# ���4��!# ���4��!# � �� �� �� � �6!�� 3�� 0! �)! ������ 1�� &� �3) )���� �!� 0%"���'" 'k 0?�#�_ +�F 3�� �6�! ��! �!$! ��) )���� �!� �"�7��� �1� �&�" 1�]� "& �6�! search function � ��8�� ���& �#� �&� �� )���� �!� � 0%"���'" 'k$# �� &��

��" 6��!।

�|[ F�9��- E�[�|[ F�9��- E�[�|[ F�9��- E�[�|[ F�9��- E�[\- ( JAVASCRI PT SEARC\- ( JAVASCRI PT SEARC\- ( JAVASCRI PT SEARC\- ( JAVASCRI PT SEARCH FUNCTI ON)H FUNCTI ON)H FUNCTI ON)H FUNCTI ON) ) ��� ���'!� regular expression L+! �� &� ��� �� 6�7G� �� ��� �3 "� regular expression � ��1 match

��F ��!�। 3�� match �� "& � ��� � position ���!� ��&। �� 3�� match !� �� "& -N ���!� ��&।

SEARCH FUNCTI ON REGUSEARCH FUNCTI ON REGUSEARCH FUNCTI ON REGUSEARCH FUNCTI ON REGULAR EXPRESSI ON:LAR EXPRESSI ON:LAR EXPRESSI ON:LAR EXPRESSI ON: � �! ���� $#�#E6#!� �3, 3�! �6�! regular expression �"�7 ��&! "�! � 0&'�) �#� slash � �8� 1��&। �!�

���+�! ���� + �। 01.<script> 02.var myRegExp = /Alex/; 03.var string1 = "Today John went to the store and talked with Alex."; 04.var matchPos1 = string1.search(myRegExp); 05. 06.if(matchPos1 != -1) 07.document.write("There was a match at position " + matchPos1); 08.else 09.document.write("There was no match in the first string"); 10. 11. 12.</script>

%�'�!:

There was a match at position 45There was a match at position 45

G� ��#!, ����� regular expression � �F '#8# �� !�� "Alex" । � search function � ) !�� &�&+�� ��

���F �3 string1 � �6�[" ��F ��!�। � ���'!� ��1 match ��F � ���� match � 6��'! (QR) ���

�6��F।

�|[ F�9��- E�[�|[ F�9��- E�[�|[ F�9��- E�[�|[ F�9��- E�[\- ( STRI NG SEARCH FU\- ( STRI NG SEARCH FU\- ( STRI NG SEARCH FU\- ( STRI NG SEARCH FUNCTI ON: ALTERNATI VE NCTI ON: ALTERNATI VE NCTI ON: ALTERNATI VE NCTI ON: ALTERNATI VE SEARCHES)SEARCHES)SEARCHES)SEARCHES)

Page 49: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

regular expression � ���� �&��� # + � pipe character "|" । 3�� ��8�� Alternative 'k search ��"

6��! । � ��� + � /RegExp1|RegExp2/ । '#8#��H �� 'k search ���� 6��&"� �6�! �! pipe character �

��8�� 0!� $# � 'k search ��" 6��!। 01.<script> 02.var myRegExp = /Alex|John/; 03.var string1 = "Today John went to the store and talked with Alex."; 04.var matchPos1 = string1.search(myRegExp); 05. 06.if(matchPos1 != -1) 07.document.write("There was a match at position " + matchPos1); 08.else 09.document.write("There was no match in the first string"); 10. 11. 12.</script>

%�'�!:

There was a match at position 6There was a match at position 6

G� ��#! ����� regular expression �#� !�� ��F: Alex &� John । � search function � ) !�� �#�

�#�" &�&+�� ��F &� ���F string1 $# � �6�[" ��F ��!�।

w&&� F�9��- E�[w&&� F�9��- E�[w&&� F�9��- E�[w&&� F�9��- E�[\- @� P�'�- \- @� P�'�- \- @� P�'�- \- @� P�'�- ( ADVANCED SEARCH FUN( ADVANCED SEARCH FUN( ADVANCED SEARCH FUN( ADVANCED SEARCH FUNCTI ON)CTI ON)CTI ON)CTI ON)

�!�� ���+�!� ��8�� 6��g�� ��& �&�I� 3�& �3 search function � ����& ��� ��। 01.<script> 02.var myRegExp1 = /Tom|Jan|Alex/; 03.var string1 = "John went to the store and talked with A lexandra today."; 04.var matchPos1 = string1.search(myRegExp1); 05. 06.if(matchPos1 != -1) 07.document.write("The first string found a match a t " + matchPos1); 08.else 09.document.write("No match was found in the first string"); 10. 11.var myRegExp2 = /Tom|Jan|Alex /; 12.var string2 = "John went to the store and talked with A lexandra today."; 13.var matchPos2 = string2.search(myRegExp2); 14.if(matchPos2 != -1) 15.document.write("<br />The second string found a match at " + matchPos2); 16.else 17.document.write("<br />No match was found in the second string"); 18. 19.var myRegExp3 = /Tom|Jan|Alexandra/; 20.var string3 = "John went to the store and talked with A lexandra today.";

Page 50: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

21.var matchPos3 = string3.search(myRegExp3); 22.if(matchPos3 != -1) 23.document.write("<br />The third string found a m atch at " + matchPos3); 24.else 25.document.write("<br />No match was found in the third string"); 26. 27.var myRegExp4 = /Tom|Jan|Alexandra/; 28.var string4 = "John went to the store and talked with A lex today."; 29.var matchPos4 = string4.search(myRegExp4); 30.if(matchPos4 != -1) 31.document.write("<br />The fourth string found a match at " + matchPos4); 32.else 33.document.write("<br />No match was found in the fourth string"); 34.</script>

%�'�!:

The first string found a match at 39

No match was found in the second string

The third string found a match at 39

No match was found in the fourth stringThe first string found a match at 39

No match was found in the second string

The third string found a match at 39

No match was found in the fourth string

������� �|[ ��B9 ������� �|[ ��B9 ������� �|[ ��B9 ������� �|[ ��B9 ( JavaScr i pt St r i ng Repl ace)( JavaScr i pt St r i ng Repl ace)( JavaScr i pt St r i ng Repl ace)( JavaScr i pt St r i ng Repl ace)� ��� ��� ��� �� ������������: ���4��!# ���4��!# ���4��!# ���4��!# � �� �� �� � ������� ��� 0&�o � �! G�"� ��F 3�� ��8�� �6�! ��� � ��"� �3��! 'k� ���� ��" 6��!। ���� ���'!�

��+�8� �6�! )� � ��� � ��8�� �6�! &�&+�����7� !�� ��L+ ��" 6��!। ������������ ���������������� ���'!���'!���'!���'!:

��� ���� ���'! � �#) 8�!� 3#�_ ��F:

N.SearchFor: ���! 'k� ���� +" 3�2। � +" 6�� ��� &� ��$# �� M%'!।

O.ReplaceText: ���! 'k� ���� ��� +&। � ��� � %���!।

���� ���'!� �����: " 'k�+ !"# ! ��� ���!� ��। 3�� ���! !"# ! 'k ���� ��� !� +� "& 6#��"! ���� ���!� ��।

��B9 E�[\-��B9 E�[\-��B9 E�[\-��B9 E�[\-::::�|[ ��B9�|[ ��B9�|[ ��B9�|[ ��B9 �! ���� ���� ���� ��&� &� &�&+�����7� !�� `��� �� ���� ��&�। %1� 3#�_ +2 ���� �� ���� ���F &� �`"7�� +2

Page 51: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

�� ���� ��" 3��2। 01.<script> 02.var visitorName = "Chuck"; 03.var myOldString = "Hello username! I hope you enjoy you r stay username."; 04.var myNewString = myOldString.replace("username", visit orName); 05. 06.document.write("Old string = " + myOldString); 07.document.write("<br />New string = " + myNewString); 08. 09.</script>

%�'�!:

Old string = Hello username! I hope you enjoy your stay username.

New string = Hello Chuck! I hope you enjoy your stay username.Old

string = Hello username! I hope you enjoy your stay username.

New string = Hello Chuck! I hope you enjoy your stay username.

�6� ���� 3�2 '#8#��H %1� )���� !��� 6��&�"�" +�F। � +2 SearchFor 3#�_� �7��&u"�। ��$# �� M%'! &�&+���

��8�� ) ����� �#� ��" 6���।

��B9 E�[\-��B9 E�[\-��B9 E�[\-��B9 E�[\-::::0�j �� @A.\-0�j �� @A.\-0�j �� @A.\-0�j �� @A.\-

���� ��� � 6��&"� ��$# �� M%'! &�&+�� ��&। ��! 6�1��� +2 '#8# �����'!� 6��&"� >��' &�&+�� ��&�। 01.<script> 02.var visitorName = "Chuck"; 03.var myOldString = "Hello username! I hope you enjoy you r stay username."; 04.var myNewString = myOldString.replace(/username/, visit orName); 05. 06.document.write("Old string = " + myOldString); 07.document.write("<br />New string = " + myNewString); 08. 09.</script>

%�'�!%�'�!%�'�!%�'�!:

Old string = Hello username! I hope you enjoy your stay username.

New string = Hello Chuck! I hope you enjoy your stay username.Old

string = Hello username! I hope you enjoy your stay username.

New string = Hello Chuck! I hope you enjoy your stay username.

��� "��6�4 ���� 32 �& )���� !�� 6��&"� ! +��!।�$# �� M%'! � ���&� %6��� � ��8�� ) ����� �#� ��� 3��।

Page 52: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

��B9 E�[\-��B9 E�[\-��B9 E�[\-��B9 E�[\-::::0��$� 0��$� 0��$� 0��$� 0�j �� @A.\-0�j �� @A.\-0�j �� @A.\-0�j �� @A.\-

��$# �� M%'! � �'9 g )!6# �� ���� ���&� M%'! �"�7 ��" 6���। 01.<script> 02.var visitorName = "Chuck"; 03.var myOldString = "Hello username! I hope you enjoy you r stay username."; 04.var myNewString = myOldString.replace(/username/g, visi torName); 05. 06.document.write("Old string = " + myOldString); 07.document.write("<br />New string = " + myNewString); 08. 09.</script>

%�'�!:

Old string = Hello username! I hope you enjoy your stay username.

New string = Hello Chuck! I hope you enjoy your stay Chuck.Old string

= Hello username! I hope you enjoy your stay username.

New string = Hello Chuck! I hope you enjoy your stay Chuck. 3�+�� �'9 ���� �� + ��।����� �! ���" +& �3 3�� ���� �� 'k ���� ��" ��) ��GH ��� &� ��8��! ��$# ��

M%'! &�&+�� ��� ���"।3�� �& ���� ��" ��) ��GH ���&� ��$# �� M%'! &�&+�� ��� ���"।

������� �|[ >-1AFE E�[\- �������� ������� �|[ >-1AFE E�[\- �������� ������� �|[ >-1AFE E�[\- �������� ������� �|[ >-1AFE E�[\- �������� ( JavaScr i pt ( JavaScr i pt ( JavaScr i pt ( JavaScr i pt i ndexOf Funct i on)i ndexOf Funct i on)i ndexOf Funct i on)i ndexOf Funct i on)� ��� ��� ��� �� ������������: ���4��!# ���4��!# ���4��!# ���4��!# � �� �� �� �

��� ���'! indexOf � ��8�� �6�! ��8��! ���� � %���! �#) 8�!� 3#�_ ���'!�� ��8�� 6�&!। %1�� +2 ���� ������

&� 6��� +2 0��।

�|[ >-1AFE E�[�|[ >-1AFE E�[�|[ >-1AFE E�[�|[ >-1AFE E�[\-:\-:\-:\-:

)!.M0� ���'! �# 8�!� 3#�_ ��F। 3�� �`"7�� +2 ��2�।

N.SearchString:3� �6�! ���� ��" ��2!। O.Offset (��2�):

)!.M0�)!.M0�)!.M0�)!.M0� ���'!���'!���'!���'! ���+�!���+�!���+�!���+�!:

��8��! )��� ��� www � 6��'! �&� ��" 6���। 1.<script> 2.var aURL = " http://www.tizag.com/ ";

Page 53: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

3.var aPosition = aURL.indexOf("www"); 4. 5.document.write("The position of www = " + aPosition); 6.</script>

%�'�!:

The position of www = 7The position of www = 7

)!.M0�)!.M0�)!.M0�)!.M0� ���'!���'!���'!���'! 0��0��0��0�� ���+�!���+�!���+�!���+�!:

3�� ���� )!.M0� ���'! &�&+�� �� %1� www � 6��'! �&� ��" 6��� �"��! %1� www �� &D �� 6�� www �

6��'! �&� ��" 6���। 01.<script> 02.var aURL = " http://www.tizag.com/www.html "; 03.var aPosition = aURL.indexOf("www"); 04.var secondPos = aURL.indexOf("www", aPosition + 1); 05. 06.document.write("The position of www = " + aPos ition); 07.document.write("<br />The position of the second www = " + secondPos); 08. 09.</script>

%�'�!:

The position of www = 7

The position of the second www = 21The position of www = 7

The position of the second www = 21

���������������������������� 0V�@� �?�$�>+>�10V�@� �?�$�>+>�10V�@� �?�$�>+>�10V�@� �?�$�>+>�1( JavaScr i pt get El ement ByI d Tut or i al i n ( JavaScr i pt get El ement ByI d Tut or i al i n ( JavaScr i pt get El ement ByI d Tut or i al i n ( JavaScr i pt get El ement ByI d Tut or i al i n Bangl a)Bangl a)Bangl a)Bangl a)

� ��� ��� ��� �� ������������: ���4��!# ���4��!# ���4��!# ���4��!# � �� �� �� �

�6�! �� ��!4 ������� &�&+�� �� ��� ��� .'! ��F!?�M ���� ���! �� # 3���) ��" ���! ������ 6aF!? �� �+��6��� ��8�� )�� � � �- �!�s! ��" 6��!।�)�. ���&� &� �$ � �-&�)�)�. ���'!� ��8�� "� ��"

6��!।

����������������������������: .]�-.]�-.]�-.]�-.�$ � �-&�)�)�.�$ � �-&�)�)�.�$ � �-&�)�)�.�$ � �-&�)�)�. (document.getElementById)

Page 54: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

01.<script>

02.function notEmpty(){

03.var myTextField = document.getElementById('myTex t');

04.if(myTextField.value != "")

05.alert("You entered: " + myTextField.value)

06.else

07.alert("Would you please enter some text?")

08.}

09.</script>

10.<input type='text' id='myText' />

11.<input type='button' onclick='notEmpty()' value= 'Form Checker' />

%�'�!:

document.getElementById � ��)M )�� � � �- � ������� ���!� ��।���� )

������� myTextField !��� �����& ��� ��" 6���।

�$ � �-&�)�)�.�$ � �-&�)�)�.�$ � �-&�)�)�.�$ � �-&�)�)�. �&9��&9��&9��&9� 3�3�3�3� �!�!�!�! ���������������� ��������������������:

3�! �6�! getElementById function &�&+�� ��&! "�! �6!�� ��F# �&9� ��D �!�Y" +4�� %���!। �6!�� 0&'�) �! ���� %���! �3 �$ � �-&�)�)�. +2 .]�- 0&�o � 6u�" &� ���'!।�6�! ) �$ � �-&�)�)�. ���'!

&�&+�� ��" ��) �6!�� 0&'�) )�� � � �- � �)�. ���&� &�&+�� ��" +&।

���������������������������� >-��>-��>-��>-�� @>6��@�@ @>6��@�@ @>6��@�@ @>6��@�@ ( JavaScr i pt i nner HTML)( JavaScr i pt i nner HTML)( JavaScr i pt i nner HTML)( JavaScr i pt i nner HTML)

� ��� ��� ��� �� ������������: ���4��!# ���4��!# ���4��!# ���4��!# � �� �� �� �

� �&p��� �3 ���� ����& )�� � �!-� 6��&"� ! ��" 6��&�! )!�� )�� � � ��8�� ���� �M� 6��&"� !

��" 6���।

Page 55: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

)!��)!��)!��)!�� )�� � )�� � )�� � )�� � (innerHTML) � � � � ��8����8����8����8�� �M��M��M��M� 6��&"� !6��&"� !6��&"� !6��&"� !:

%"�� )�� � � �- � )!�� )�� � %6��� ��F 3� )�� � ���. &� �M ���� �!��' �� 3�� 46�!� &�

�,���� ��$� �8� 6�4�� 3��। � �-� )!�� )�� � %6��� 6��&"� ! �� ��9�d7� 4�& �6� �"�7 ��� 3��। )!�� )�� � %6��� �� �+���& &�&+�� ��" ��) ��F# %��"� %���!। %1� � �- � �)�. ��" +& "��6�

"�� getElementById function � ��8�� 6���� !� ��" +&। 1.<script>

2.function changeText(){

3.document.getElementById('boldStuff').innerHTML = 'Fred Flinstone';

4.}

5.</script>

6.<p>Welcome to the site <b id='boldStuff'>dude</b> </p>

7.<input type='button' onclick='changeText()' value='Change Text'/>

%�'�!

Welcome to the site dude 3�+�� ���� ��! �� ����& )�� � � �- � �M� 6��&"�! ��� 3��।��� ���� �!4 ���!!� ����& &�&+�����7�

���� �M� ��6G ���� )�� � �M� 6��&"� ! ��" 6��&�। �!� � � ��!� ��� + �।

>��� >-,a�� ,� ��>��� >-,a�� ,� ��>��� >-,a�� ,� ��>��� >-,a�� ,� ���c �� 0�A�� ,���c �� 0�A�� ,���c �� 0�A�� ,���c �� 0�A�� ,��$&R-$&R-$&R-$&R-:::: 01.<script>

02.function changeText2(){

03.var userInput = document.getElementById('userInput').va lue;

04.document.getElementById('boldStuff2').innerHTML = userInput;

05.}

06.</script>

07.<p>Welcome to the site <b id='boldStuff2'>dude</ b> </p>

08.<input type='text' id='userInput' value='Enter Text Here' />

09.<input type='button' onclick='changeText2()' value='Change Text'/>

Page 56: Javascript Tutorial in Bangla). Javascript bangla tutorials.pdfBangla) Bangla) ˙˙ ˝˝˛˛˙ ... >= Greater Than or Equal To x>=y 1 0 $ (JavaScript Variable Tutorial in Bangla) Bangla)

%�'�!

Welcome to the site dude

Enter Text

)!�� )�� � (innerHTML) � ��+" )�� � � 6��&"� !:

�6�! � �-� �8� )�� � )!��� ��" 6��!। ���� �M� �� ��4 6��&"� ! ��" 6���। 01.<script>

02.function changeText3(){

03.var oldHTML = document.getElementById('para').innerHTML ;

04.var newHTML = "<span style='color:#ffffff'>" + oldHTML +"</span>";

05.document.getElementById('para').innerHTML = newH TML;

06.}

07.</script>

08.<p id='para'>Welcome to the site <b id='boldStuf f3'>dude</b> </p>

09.<input type='button' onclick='changeText3()' value='Change Text'/>

%�'�!

Welcome to the site dude


Recommended