codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Drop-down list from text file  lantamer at 08:25 on Thursday, August 03, 2006
 

I need to make script that creates drop-down list from text file (new line in text file – new line in drop-down list). Somebody told me that I should use XMLHttpRequest for that, so I have found on internet script that can write content from text file on screen, but I don’t know how to modify it to write it in drop-down list.

How to add reference.value to make values for drop-down?


This is it:

<html>
<head>
<title>XMLHttpRequest Object GET Request</title>
</head>
<body>

<script language="javascript" type="text/javascript">
<!--

// request variable
var request_var;

// Request object method wrapper function
function request_object()
{
try
{
return new ActiveXObject('Msxml2.XMLHTTP');
}
catch(e)
{
try
{
return new ActiveXObject('Microsoft.XMLHTTP');
}
catch(e)
{
return new XMLHttpRequest();
}
}
}

// Call the request object method wrapper function
request_var=request_object();

if(!request_var)
{
alert("Your Web browser does not support the XMLHttpRequest object.");
}

function load()
{
if(request_var.readyState==4)
{
document.getElementById('elements_id').innerHTML=request_var.responseText;
}
}

function call()
{
if(request_var)
{
d=document;
request_var.open("GET","/forum/textfile.txt",true);
request_var.onreadystatechange=load;
request_var.send(null);
}
}

//-->
</script>

<div id="elements_id"></div>

<a onclick="call()" href="#">XnMLHttpRequest Object GET Request</a>
</body>
</html>










CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: C++ Beginner question
•  Re: function within loop problem
•  moncler outlet
•  Re: Display swf file in pdf
•  Re: how to create forum using asp.net with c# language?
•  Discount coach store
•  Create Better Maps with Global Mapper
•  Re: How to display a message box when record is temporary stored in session/grid view
•  Sharing object in perl


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2012