How to use javascript without dialog boxes?

Asked

Viewed 475 times

0

I want to ask the user for information only without using those dialog boxes and leave it printed there on the site, with the use of input. Is it javascript that does this? I tried to google something and I didn’t find anything. I really want to be able to program my website, but I have no idea where to start learning, or anything like that. If you have a tip I appreciate.

Note: This is an example of what I’m trying to do, since I didn’t explain so well... Obs2.: I read what you put, only to ask for information like this, where I will store the answer, I do not know any other way without using the prompt... But if I use it I will have to use javascript, which consequently it will appear in a dialog box.

Exemplo:

  • And why don’t you use forms?

  • As such ( I am a layperson in this subject ) Using formularies in html or javascript?

  • https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Forms

  • http://www.w3schools.com/html/html_form_elements.asp

  • I find this one very illuminating: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Forms/My_first_HTML_form

  • http://www.codecademy.com/#! /Exercises/0 <- starts in HTML and evolves to Javascript

  • vlww.. I’ll take a look! :)

  • @Vanessacristina, if you want to add a Search to your page, maybe the ideal is to use the Google Forms, you can either add the same inside an iframe or through the API

Show 3 more comments

2 answers

1

Let’s see, you can do an input and an Submit button, this when clicked (onClick) will call a javascript function that will take the input data and do what you want. Remembering that using Javascript the user will be able to see the code of your script, then he will be able to know the whole process involving input.

  • 2

    Hide Javascript Inside to image - there are people who amaze me with so much creativity.

  • Once I gave an answer without sending code and almost punished me for it, turned my reply into comment, I had to withdraw the "comment" to avoid the downvotes. Jaedson, give an example to the colleague, only for the answer to enter the standard of Sopt.

0


I don’t know if I understand what you want, but from what I read you want to give a message to the user, in some position on your page other than by alert() or something like that. You can use javascript’s Innerhtml for this, if that’s what I’m getting. With it you give the message in a certain position, as a <div>, or a input text and etc..., it would be like this: Set an area with a preferred id. This area is where you will give the message. Let’s assume it is id="txt_msg". Then you do:

function ExibeMensagem(pNomeParametroQualquer) {
    document.getElementById('txt_msg').innerHTML = 'Minha Mensagem';
}

In your Form(web), you in any event, like click or change of textbox, you call the function:

<input button id="ffff" onclick="ExibeMensagem(qualquer_coisa)" />

I guess that’s what I figured out what you want.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.