I have an JSP file, which is called from a button of a form in a HTML file. In this JSP I get the option selected in a drop-downlist of the form, which is saved into the variable "topic".
In this JSP file I have another button that have to call the Javascript function crearframe(). The parameter have to be the value saved in the variable "topic". How can I do that?
I need to open a different html file when the user press the button depending of the value of the variable "topic". The name of the html file will be "topicValue" + ".html".
Is there any way of doing this?
Thank you very much.
Here is the code.
<script language="javascript">
function crearframe(htmlFilePath) {
var testframe = document.getElementById("iframe");
testframe.src = htmlFilePath + ".html";
}
</script>
</head>
<body>
<table width="100%">
<tr>
<td align="center" valign="top">
<%
String topic = request.getParameter("opcion");
out.println("<H2>Resultado del anĂ¡lisis sobre " + topic + "</H2>");
%>
<div id="grafica"></div>
<table width="80%">
<tr>
<td align="center" width="25%">
<button type="button" name="Analizar1" class="btn btn-primary" Onclick="crearframe('HaveToBeTheTopicVariable')" >Ver;</button>