我如何履行自己的职责范围?我要在我的网页上单击一个下拉列表,该列表带有一些静态选项,然后单击下拉列表(语言)中的某项
<td align="left">
<SELECT name="language" >
<OPTION value="ro" selected>Romana</OPTION>
<option value="en">English</option>
<option value="de">Deutsch</option>
</SELECT>
选择一个选项,我希望$language
变量获取新的
值,并在更改了$language
变量的情况下重新加载页面。
在目标网页上,我得到了一个PHP函数,该函数基于$language
变量值返回HTML文本元素(此部分已经在工作)。
以下是我的完整设置:
index.php
<?php
if( isset( $_GET['target'] ) )
$target = $_GET['target'];
else
$target = "productie";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN">
<!-- saved from url=English/index.php -->
<HTML><HEAD><META content="IE=7.0000" http-equiv="X-UA-Compatible">
<TITLE>website name</TITLE><!--
-->
</HEAD>
<FRAMESET frameSpacing=0 border=0 frameBorder=NO rows=65,* cols=*>
<FRAME noResize marginHeight=0 src="web_files/top.html" name=topFrame marginWidth=0 scrolling=no>
<FRAMESET frameSpacing=0 border=0 frameBorder=NO cols=224,*>
<FRAME noResize marginHeight=0 src="web_files/menu.php?target=<?php echo $target?>" name=leftFrame marginWidth=0>
<FRAME marginHeight=0 src="web_files/right.php?target=<?php
echo $target;
if( isset( $_GET['id'] ) )
?>" name="contentFrame" id="content" marginWidth=0>
</FRAMESET>
</FRAMESET>
</HTML>
下一个是我想在此处放入选项列表的menu.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0099)http://w01abin05/intranet/english/navigation/Control.php -->
<HTML><HEAD><META content="IE=5.0000" http-equiv="X-UA-Compatible">
<TITLE>TAKATA</TITLE><!--
-->
<LINK rel=stylesheet
type=text/css href="Control_files/style_header.css">
<SCRIPT language=JavaScript type=text/JavaScript
src="Control_files/script.js"></SCRIPT>
<SCRIPT language=JavaScript type=text/JavaScript>
var i = "leer";
function highlight (id)
{
if(i!='leer')
document.getElementById(i).style.color="#ffffff";
document.getElementById(id).style.color="#000000";
i=id;
}
function changeOver(id)
{
if(id!=i)
document.getElementById(id).style.color="#000000";
}
function changeOut(id)
{
if(id!=i)
document.getElementById(id).style.color="#ffffff";
}
</SCRIPT>
<META name=GENERATOR content="MSHTML 10.00.9200.17028"></HEAD>
<BODY background="Control_files/bg_navi2.jpg" leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
<TABLE height="96%" cellSpacing=0 cellPadding=0 width=208 border=0>
<TBODY>
<TR>
<TD class=blue12bold vAlign=top background="Control_files/bg_navi.gif" height="5%"><BR /> Rapoarte OPFSYS</TD></TR>
<TR >
<TD vAlign=top height="2%" valign="top" <?php if( $_GET['target'] == 'productie' ) echo " bgcolor=\"#A0A0A0\" ";?>> <a href="../index.php?target=productie" target="_parent">Raport productie</a></TD></TR>
<TR >
<TD vAlign=top height="2%" valign="top" <?php if( $_GET['target'] == 'productie_celule' ) echo " bgcolor=\"#A0A0A0\" ";?>> <a href="../index.php?target=productie_celule" target="_parent">Productie celule</a></TD></TR>
<TR>
<TD vAlign=top height="2%" <?php if( $_GET['target'] == 'id_details' ) echo " bgcolor=\"#A0A0A0\" ";?>> <a href="../index.php?target=id_details" target="_parent">Trasabilitate piesa</a></TD></TR>
<TR>
<TD vAlign=top height="2%" <?php if( $_GET['target'] == 'pontaj' ) echo " bgcolor=\"#A0A0A0\" ";?>> <a href="../index.php?target=pontaj" target="_parent">Pontaj celule</a></TD></TR>
<TR>
<TD vAlign=top height="2%" <?php if( $_GET['target'] == 'wip' ) echo " bgcolor=\"#A0A0A0\" ";?>> <a href="../index.php?target=wip" target="_parent">Piese in lucru</a></TD></TR>
<TR>
<TD vAlign=top height="2%" <?php if( $_GET['target'] == 'rework' ) echo " bgcolor=\"#A0A0A0\" ";?>> <a href="../index.php?target=rework" target="_parent">Reparatii</a></TD></TR>
<TR>
<TD vAlign=top height="2%" <?php if( $_GET['target'] == 'logistics' ) echo " bgcolor=\"#A0A0A0\" ";?>> <a href="../index.php?target=logistics" target="_parent">Raport logistica</a></TD></TR>
<TR>
<TD vAlign=top height="2%" <?php if( $_GET['target'] == 'perf_celule' ) echo " bgcolor=\"#A0A0A0\" ";?>> <a href="../index.php?target=perf_celule" target="_parent">Performanta celule</a></TD></TR>
<TR>
<TD vAlign=top height="2%" <?php if( $_GET['target'] == 'downtime' ) echo " bgcolor=\"#A0A0A0\" ";?>> <a href="../index.php?target=downtime" target="_parent">Raport intreruperi</a></TD></TR>
<!--
<TR>
<TD vAlign=top height="2%" <?php if( $_GET['target'] == 'new_report' ) echo " bgcolor=\"#A0A0A0\" ";?>> <a href="../index.php?target=new_report" target="_parent">Raport nou</a></TD></TR>
!-->
<TR>
<TD vAlign=top height="2%" <?php if( $_GET['target'] == 'first_time' ) echo " bgcolor=\"#A0A0A0\" ";?>> <a href="../index.php?target=first_time" target="_parent">First Time Pass</a></TD></TR>
<TR>
<TD vAlign=top height="2%" <?php if( $_GET['target'] == 'qgate' ) echo " bgcolor=\"#A0A0A0\" ";?>> <a href="../index.php?target=qgate" target="_parent">Raport Q-gate</a></TD></TR>
<TR>
<TD vAlign=top height="2%"> <a href="/OPFSYS/web/" target="_blank">Ajustare performanta</a></TD></TR>
<TR>
<TD vAlign=top height="2%"> <a href="http://server1/portal" target="_blank">Helpdesk PE-IT</a></TD></TR>
<!--
<TR>
<TD vAlign=top height="2%"> <a href="../index.php?target=combined" target="_parent">Raport combinat</a></TD></TR>
!-->
<tr>
<TD class=blue12bold vAlign=top background="Control_files/bg_navi.gif" height="5%"><BR /> Rapoarte Montaj</TD></TR>
<TR>
<TR>
<TD vAlign=top height="2%" <?php if( $_GET['target'] == 'bmw_ms_fa_control' ) echo " bgcolor=\"#A0A0A0\" ";?>> <a href="../index.php?target=bmw_ms_fa_control" target="_parent">Control BMW MS</a></TD></TR>
<TR><TD vAlign=top height="2%" <?php if( $_GET['target'] == 'bmw_ukl_opc' ) echo " bgcolor=\"#A0A0A0\" ";?>> <a href="../index.php?target=bmw_ukl_opc" target="_parent">Log OPC BMW UKL</a></TD></TR>
<TR><TD vAlign=top height="2%" <?php if( $_GET['target'] == 'labelling' ) echo " bgcolor=\"#A0A0A0\" ";?>> <a href="../index.php?target=labelling" target="_parent">Reetichetare</a></TD></TR>
<tr>
<TD class=blue12bold vAlign=top background="Control_files/bg_navi.gif" height="5%"><BR /> Rapoarte Turnatorie</TD></TR>
<TR>
<TR>
<TD vAlign=top height="2%"<?php if( $_GET['target'] == 'dc_dot_marking' ) echo " bgcolor=\"#A0A0A0\" ";?>> <a href="../index.php?target=dc_dot_marking" target="_parent"><img src="Control_files/circle_big.png" style="width:5px;height:5px;" alt="dot" border="0"> marking</a></TD></TR>
<TR>
<TD vAlign=bottom align=left ><IMG src="Control_files/nav_logo.gif"
width=47 height=211>
</TD>
</TR>
</TBODY>
</TABLE>
</BODY></HTML>
答案 0 :(得分:1)
您可以使用onchange
事件来获取新选择的选项的值。
$(document).ready(function(){
$('select[name=language]').change(function() {
});
});
如果要提交数据,请添加一个ajax post
$(document).ready(function(){
$('select[name=language]').change(function() {
var _lang = $( "select['name=language'] option:selected" ).text(); //Get the text of the selected option, you can use .val() instead to get the the content of the value attribute
$.post( "languageHandler.php",{ language: _lang}, function(data) {
$('body').append(data); //Append the new data to body
});
});
});