+ 3
Show HTML Codings not the words?
I have made a programme in javascript.Details are given here:- i enter a string/chrachter or paragraph and the programme will convert it to html codes for example : I enter "ABCD" and programm will give me the values "ABCD" but when i run the programme in browser this prints "ABCD" rather html codes. So the Question is how to show codes in browser rather than Alphabets. my code is <script type="text/javascript"> var str = 'ABCD'; for (var i = 0; i < str.length; i++) { var arr=new Array(str.charAt(i)); var alpha =[]; alpha["A"]="A"; alpha["B"]="B"; alpha["C"]="C"; alpha["D"]="D"; for(j=0;j<arr.length;j++){ document.write(alpha[arr[j]]); } } </script>
4 Réponses
+ 3
i have solved the problem
see my code
https://code.sololearn.com/Wao18gdsAVQm
+ 4
because document.write is something like html eval
+ 4
push results into an array then use alert or console.log I don't know which work though
+ 3
Mert Yazıcı Mert Yazici so how to write it?