Hello I'm trying to make a simple web chat, and I want the user to choose his name when he first load the chat page and for this I'm using this function:
function Login(un)
{
var x=prompt("Please enter your name","");
var xmlhttp;
if (window.XMLHttpRequest)
  {// Използваните браузъри
  xmlhttp=new XMLHttpRequest();
  }
else
  {// Кой ли ползва тези версии..
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
    xmlhttp.open("GET","login.php?u="+un,true);
    xmlhttp.send();
}
I put this in the head section and then in the body onload... I call the function but can't figure out how to extract the text from the prompt box.I tried
login(getElementsByName('x').开发者_开发百科value)
But obvously that's not the way, so, please help. Thanks Leron
var x=prompt("Please enter your name","");
Then x has the value entered in the prompt.
var login = getElementsByName('loginboxname').value;
Just make sure you replace "loginboxname" with the actual name of your login box. The variable "login" should then the value of that box.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论