dpy15285 2014-07-10 10:41
浏览 95

php - 动态设置样式和输入值

I have problem with my form. This form is used for search through DB and it has two parts, one is visible and one is expanded by click (it's advanced search).

The problem is, that when I proceed with search and get results the container will hide anyway and the value is not viewed in the input.

But that happened only if I use "RCD ID", when I search for "Place" everything is working just fine. I don't know what I missed.

Bellow are some examples of the code, if needed, I can provide more

Thanks for help

<form name=s style="display: inline; margin: 0px;" action="<?= $_SERVER['PHP_SELF']?>" method=get autocomplete="off">
<table>
<tr><td>Some inputs..</td></tr> 

Below it's logic for expanding the container

//expanded search 

<a href="#" class=navig-advanced onclick="if (document.getElementById('advanced').style.display == 'none') document.getElementById('advanced').style.display='block'; else document.getElementById('advanced').style.display='none'; return false;"><img src="img\icon_select.png" align=absmiddle hspace=0 border=0>&nbsp;&nbsp;advanced search</a>
<?
if ($searchpar['tel'] || $searchpar['fce'] || $searchpar['diviz'] || $searchpar['pracus'] || $searchpar['res'] || $searchpar['mist'] || $searchpar['rcd_id'] || $searchpar['rx4_id'] || $searchpar['ns']) $disp = 'block';
  else $disp = 'none';
?>
<div id=advanced style="display: <?= $disp ?>; width: 201px;" class=tabcontent-search>
<table class=navig-table>

Here are some inputs, the first one is working, the second one is not

//then the input

<tr><td>Place:</td><td><input type=text class=navig-tabinput name=mist value="<?= $searchpar['mist']?>" id=mist <?= $_COOKIE['nosugg'] == 'yes' ? '' : " onkeyup=\"findNames('mist', 'popup8', 'table8', 'tbody8', 'closeimg8', 'load8', '', '', '');\" onkeydown=\"return catchkey(event);\" " ?>><img id=load8 style="visibility: hidden;" src="img/wait-e5effa.gif" alt="loading" border=0 hspace=2 vspace=0 align=absmiddle>
  <div id="popup8" class="suggest-div">
    <table id="table8" class="suggest-tab">
        <tbody id="tbody8"></tbody>
    </table>
      <img src="img\dash.png" hspace=0 vspace=2><br>&nbsp;<a class=suggest-link alt="don't use suggestions" href="?mode=nosugg&backmode=<?= $mode ?>">turn off suggestion</a>&nbsp;<a class=suggest-link href="#" onclick="document.getElementById('popup8').style.display='none'; return false;"><img id="closeimg8" style="position: absolute; left: 112px;" src="img\close.png" border=0 alt="close window"></a>
    </div>
</td></tr>
<tr><td><span class=help title="RCD ID">RCD ID:</span></td><td><input type=text class=navig-tabinput name=rcd_id value="<?= $searchpar['rcd_id']?>" id=rcd_id <?= $_COOKIE['nosugg'] == 'yes' ? '' : " onkeyup=\"findNames('rcd_id', 'popup9', 'table9', 'tbody9', 'closeimg9', 'load9', '', '', '');\" onkeydown=\"return catchkey(event);\" " ?>><img id=load9 style="visibility: hidden;" src="img/wait-e5effa.gif" alt="loading" border=0 hspace=2 vspace=0 align=absmiddle>
  <div id="popup9" class="suggest-div">
    <table id="table9" class="suggest-tab">
        <tbody id="tbody9"></tbody>
    </table>
       <img src="img\dash.png" hspace=0 vspace=2><br>&nbsp;<a class=suggest-link alt="don't use suggestion" href="?mode=nosugg&backmode=">turn off suggestion</a>&nbsp;<a class=suggest-link href="#" onclick="document.getElementById('popup9').style.display='none'; return false;"><img id="closeimg9" style="position: absolute; left: 112px;" src="img\close.png" border=0 alt="close window"></a>
    </div>
</td></tr>
  • 写回答

1条回答 默认 最新

  • dongxian6741 2014-07-10 11:16
    关注

    My first impression is that you are trying to hide elements that having the ID advanced. But with HTML only one element on the page can have the same ID. Try to use libraries like jQuery where you can pinpoint the closest element to hide when clicking a button near it.

    Last but not least: do not use tables for forms. Just use styled <div>'s. And also use CSS rather than using the style key.

    评论

报告相同问题?

悬赏问题

  • ¥15 linux驱动,linux应用,多线程
  • ¥20 我要一个分身加定位两个功能的安卓app
  • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
  • ¥15 IAR程序莫名变量多重定义
  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题
  • ¥15 目标检测项目无法读取视频
  • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
  • ¥100 求采集电商背景音乐的方法
  • ¥15 数学建模竞赛求指导帮助