1

Is there anyway to load the drop down menu of an html from another file(A text file) ?

I tried this and I guess it is not working.

<form>
<select name  = "Name">
<!--#include virtual="options.txt" -->
</select>
</form>

and inside options.txt

<option value = "42a">42A</option>
<option value = "42b">42B</option>
<option value = "42c">42C</option>
<option value = "42d">42D</option>
<option value = "42e">42E</option>
<option value = "43a">43A</option>
3
  • 1
    Yes, but you'd need to use server-side includes, server-side scripts (php, and so on) or client-side scripts (javascript/jQuery, etc.). Which would you be willing to accept or work with? Commented Oct 18, 2010 at 19:54
  • 2
    Which server side code are you working with? Commented Oct 18, 2010 at 20:00
  • I just know Perl..or thats what I think.Would like to stick to it. Is there anyway I can achieve this ? Commented Oct 18, 2010 at 20:03

3 Answers 3

1

Load on the server in java / jsp

<%@ include file="drop_down.jspf" %>
// Or 
<jsp:include page="<%=variable_containing_relative_path_to_drop_down.jspf%>" />

Load by the browser in javascript / jQuery

$("#my_container").load("http://mon_site.com/fragment/drop_down.html");
Sign up to request clarification or add additional context in comments.

Comments

0

Yes, you can use a server side include.

<!--#include virtual="../header.txt" -->

1 Comment

In order for a server-side include to work, you first must be using the correct path (#virtual path is relative to the root folder). Secondly, you must be using either an Apache, Lighttbd, or IIS server.
0

I finally solved this by using html templates and Perl-CGI. The include of template works like charm.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.