菜单无法直接转到某个页面

时间:2017-05-27 04:29:25

标签: php html css codeigniter

我有菜单,有子菜单。

    private void promoCodeButtonActionPerformed(java.awt.event.ActionEvent evt) {                                                
    Random num1 = new Random();
    Random num2 = new Random();
    Random num3 = new Random();

    //convert Random to String so I use it with JOptionPane
    String n1=num1.toString();
    String n2=num2.toString();
    String n3=num3.toString();

    String equation = "What's the result of "+n1+"+"+n2+"*"+n3+"=?";
    String given = JOptionPane.showInputDialog(null, equation,connection);

    //convert String to int so I can apply equation:
    int numb1 = Integer.parseInt(n1);
    int numb2 = Integer.parseInt(n2);
    int numb3 = Integer.parseInt(n3);
    int result = numb1+numb2*numb3;
    int result1 =Integer.parseInt(given);

    //Random number promo code
    Random promo_code = new Random();

    if(given.equals(result1)){
    JOptionPane.showMessageDialog(rootPane, "Correct Answer! \nHere's your promo code is:"+promo_code+"\nEnjoy! ");
    }

    else{
    JOptionPane.showMessageDialog(rootPane, "Wrong Answer! \nTry again");

    }
}                                             

当我点击它时,我无法直接进入该页面。我必须右键单击它才能转到所需的页面。 这是我的控制器的一个例子

<li>
   <a href="#lead" data-toggle="collapse" class="collapsed"><i class="fa fa-flag-checkered" aria-hidden="true"></i> <span>Lead</span> <i class="icon-submenu lnr lnr-chevron-left"></i></a>
      <div id="lead" class="collapse ">
          <ul class="nav">
            <li><a href="#quotation" data-toggle="collapse" class="collapsed"><i class="fa fa-quote-right" aria-hidden="true"></i><span>&nbsp;Quotation </span><i class="icon-submenu lnr lnr-chevron-left"></i></a>
                <div id="quotation" class="collapse ">
                  <ul class="nav">
                     <li><a href="<?php echo base_url()."index.php/SalesAdmin/cquotation"; ?>" data-toggle="collapse" class="collapsed"><i class="fa fa-dot-circle-o" aria-hidden="true"></i>&nbsp;Create Quotation</a></li>
                     <li><a href="<?php echo base_url()."index.php/SalesAdmin/qsummary"; ?>" data-toggle="collapse" class="collapsed"><i class="fa fa-dot-circle-o" aria-hidden="true"></i>&nbsp;Quotation Summary</a></li>
                     <li><a href="<?php echo base_url()."index.php/SalesAdmin/squotation"; ?>" data-toggle="collapse" class="collapsed"><i class="fa fa-dot-circle-o" aria-hidden="true"></i>&nbsp;Send Quotation</a></li>
                  </ul>
               </div>
            </li>
         </ul>
      </div>
   </li>

你们有什么想法吗? 我完全糊涂了

1 个答案:

答案 0 :(得分:0)

为什么在每个超链接上都使用data-toggle="collapse" class="collapsed"?你的代码在每个超链接中都有data-toggle="collapse" class="collapsed" .Bootstrap会阻止href的默认点击事件。因此,删除代码中href的每个data-toggle="collapse" class="collapsed"部分都会有效。

<li>
  <a href="#lead" data-toggle="collapse" data-target="#lead"  class="collapsed"><i class="fa fa-flag-checkered" aria-hidden="true"></i> <span>Lead</span> <i class="icon-submenu lnr lnr-chevron-left"></i></a>
  <div id="lead" class="collapse ">
    <ul class="nav">
      <li><a href="#quotation" data-toggle="collapse" class="collapsed"><i class="fa fa-quote-right" aria-hidden="true"></i><span>&nbsp;Quotation </span><i class="icon-submenu lnr lnr-chevron-left"></i></a>
      <div id="quotation" class="collapse ">
        <ul class="nav">
          <li><a href="<?php echo base_url()."index.php/SalesAdmin/cquotation"; ?>" ><i class="fa fa-dot-circle-o" aria-hidden="true"></i>&nbsp;Create Quotation</a></li>
          <li><a href="<?php echo base_url()."index.php/SalesAdmin/qsummary"; ?>" ><i class="fa fa-dot-circle-o" aria-hidden="true"></i>&nbsp;Quotation Summary</a></li>
          <li><a href="<?php echo base_url()."index.php/SalesAdmin/squotation"; ?>" ><i class="fa fa-dot-circle-o" aria-hidden="true"></i>&nbsp;Send Quotation</a></li>
        </ul>
      </div>
    </li>
  </ul>
 </div>
</li>