Is writing HTML values the same as writing Javascript into HTML? [closed] - javascript

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
For my project I am not allowed to write any JavaScript into my HTML according to my teacher. That would mean that I am not allowed to write features like onClick in my HTML. I want to check a answer with the if statement by giving my buttons value's, but isn't that also seen as writing JavaScript into HTML?
I know the best thing to do would be contact my mentor, but I want to know your answer/opinion on this.

you can use JS function to get elements from the HTML such as document.getElementById or document.querySelector and bind them an event listener.
you can read more about on MDN

Related

How to create a liveurl preview of link using AngularJS or javascript, and make it clickable? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I do have a textarea element and I use angular for data-binding. I would like to capture the url in the string entered by the user, and generate a clickable live preview of that url. Any idea on how I can accomplish this using AngularJS or JavaScript? Just like Facebook.
Thanks!
You would need some server to do this for you.
You could either use a public service such as https://screenshotlayer.com/, https://www.url2png.com/
or You could run your own server with one of these libraries: https://github.com/brenden/node-webshot or https://github.com/vbauer/manet

Create Html template document from Javascript and Php variables [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am developping an application. As final result the application generates a Html document consisting of variables from external Javascript and Php files.Which is the safest way to pass these variables?.
Thank you very much.
You can use AJAX to do this, you make the request in JS, and process the information in PHP(server side), and you can return an JSON Object with the variables, or simply, return the HTML code and output it.
Hope it helps :D

How to Avoid HTML in JavaScript [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have a lot of elements that are created on the fly from data received on the server, as JSON. To create these elements a lot of HTML is going inside my JavaScript code. Is there any solution to this problem? The JavaScript code is polluted and writing HTML tags becomes harder and less maintainable.
Templating tools such as handlebars, mustache and dust.js were designed to solve this very problem.
Ember.js is another alternative that allows you to remove HTML from your JavaScript through their templating tool called HTMLBars.
Check it out!

how to inject javascript without using script tags? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I cant use the script tags
It alerts when I do , which is only useful for testing.
It filters them out:
script > *
SCRIPT > SCRIPT
sCriPt > sCriPt
so, i try to use capital script tags
but it turns to:
*CRIPT>alert(1)</SCRIPT>
I have tried using multiple tags.
How can I inject regular javascript with this?
Oh, and I cant use quotes.
Just so you know, there is an XSS Cheat Sheet you can refer to.

Adding a language code in my URL [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
i have been advised to add a language code to my url - therefore i want my homepage to read http://www.freebetoffersonline.com/en/index.php instead of http://www.freebetoffersonline.com/index.php therefore can somebody please assist me??
do i have to change the html in order to add this
my suggestion is to use an get object lang=en/other language code like http://www.freebetoffersonline.com/index.php?lang=en this is easier.
I suggest same as '.Madan Ram' http://www.freebetoffersonline.com/index.php?lang=en.
Or you can make a folder named 'en' and put your whole web site in that folder. This will help you to create different folders for different languages. But you have to make a copy of whole web page again and again regarding the language in every folder. And this is bulky.

Categories

Resources