+ 1

how to make html editor by html4, I made everything but I don't know how to make the html text opens in a new tab and works .

how to make the html text which the user have written opens in a new tab and show him his output ..please help me https://code.sololearn.com/WJ3pS5Dw8p1M/?ref=app

7th Jun 2017, 11:13 PM
Walid Kh. Sharaiyra
3 odpowiedzi
+ 16
To be honest, i found an interesting solution to create an iframe and execute inside it the code, exactly like a browser inside a browser... i thought about change the code and publish this work as mine... but i am a good person and you preceded me with this idea... so, i made this for you, hope you like it: https://code.sololearn.com/WBN3KIi8BAh3/?ref=app You can put HTML, CSS and JS in the same document, let me know what you think. :3
7th Jun 2017, 11:55 PM
Maz
Maz - avatar
+ 4
Hello @Walid, I have some sugestions for your code to work. 1. remove the form, and instead of the submit button put a button. 2. Add an onclick event to the button, e.g. <button onclick='showOutput()'>Output</button> 3. Add an ID to the <textarea>, e.g. <textarea id='t_a' ....> 4. create the function that will handle the onclick event in the javascript section, the code should be like this: function showOutput(){ var t_a = document.getElementById('t_a'); var win = window.open("", '_self'); win.document.write(t_a.value); } If you follow all the steps, your code should work. Good ideia btw.
8th Jun 2017, 12:19 AM
Ulisses Cruz
Ulisses Cruz - avatar
+ 2
thanks a lot #Maz and #UlissesCruz I'm very thank full for helping me making the html editor and of course I'll insert your name in this project😁😁
8th Jun 2017, 6:09 PM
Walid Kh. Sharaiyra