-2

在这段代码中,我使用三个链接(锚点)作为选项卡,如果我们单击该链接,它应该阻止默认值。我应该在超链接中传递 div id(a href='#')。

<div class="wrap">

<section class="container-main">

  <div class="container"> 
      <div  style="width: 100%; margin-top: 15px; height: 25px;">
          <?php echo 'Welcome &nbsp <b>'.$firstname.'</b> <br/>';?>
      </div>
<div id="slideMenu" class="closed">
    <div class="content">
<a href="../Patient/view_allergy.php"><img  src="../images/allergy1.png" width="252" height="33" border="0"/></a>
<a href="../Patient/view_medications.php"><img  src="../images/medicationsbutton.png" alt="" width="252" height="35" border="0"/></a>
<a href="../Patient/viewsocialhistory.php"><img  src="../images/socialhistorybutton.png" width="252" height="35" border="0"/></a>

    </div>
<a style="top:100px; right: -42px;" href="#" class="toggleBtn" id="toggleLink"></a></div>
 <style>
#slideMenu.closed{
    left:-300px;
}

#slideMenu{
    position:fixed;
    left:0;
    top:150px;
    width:300px;
    height:300px;
    border:5px solid #416888;
    border-left:0px;
    background-color:#FFFFFF;
    z-index:20;
}

#slideMenu a.toggleBtn{
    position:absolute;
    right:0;
    top:0;
    outline:none;
    display:block;
    height:87px;
    width:27px;
    border-width:1px 1px 1px 0px;
    margin:0;
    padding:0 5px 0;
    color:#000;
    text-decoration:none;
    font:12px/25px Verdana, Arial, Helvetica, sans-serif;
    background:url(images/arrow.gif) no-repeat;
    z-index:20;
}

#slideMenu a.toggleBtnHighlight{
    position:absolute;
    right:0;
    top:0;
    outline:none;
    display:block;
    height:87px;
    width:27px;
    border-width:1px 1px 1px 0px;
    margin:0;
    padding:0 5px 0;
    color:#000;
    text-decoration:none;
    font:12px/25px Verdana, Arial, Helvetica, sans-serif;
    background:url(images/arrow.gif) no-repeat 0px -88px;
    z-index:20;
}

.content{
    padding:5px;
    z-index:20;
}
</style>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/sidein_menu.js"></script> 
  <script type='text/javascript' src='js/jquery-1.4.2.js'></script>
  <script type="text/javascript" src="js/jquery-ui.js"></script>

      <link rel="stylesheet" type="text/css"   href="css/jquery-ui.css">



  <style type='text/css'>

  </style>

<script type="text/javascript">
$(document).load(function(){
    alert("hi");
    $("#allergy_tab").click(function(e){
        e.preventDefault()
        if($("#title").val=='select allergy')
        {
            alert("select food allergy");
        }
    })
})
</script>


<script type='text/javascript'>//<![CDATA[ 
$(window).load(function(){

$("#tabs").tabs();
$("#allergy_tab").click(function() {


    if($("#title").val()=='select food allergy')
        {
            alert("select food allergy");
        }
    else if($("#e_allergy").val()=='select environmental allergy')
        {
            alert("select environmental allergy");
        }

        else if($("#m_allergy").val()=='select metal allergy')
        {
            alert("select metal allergy");
        }


        else {
    var selected = $("#tabs").tabs("option", "selected");
    $("#tabs").tabs("option", "selected", selected + 1);
        }
});

$("#tab_allergy2").click(function(event) {

    event.preventDefault();
    if($("#title").val()=='select food allergy')
        {
            alert("select food allergy");
        }
    /*else if($("#e_allergy").val()=='select environmental allergy')
        {
            alert("select environmental allergy");
        }

        else if($("#m_allergy").val()=='select metal allergy')
        {
            alert("select metal allergy");
        }*/

    /*  
        else {
    var selected = $("#tabs").tabs("option", "selected");
    $("#tabs").tabs("option", "selected", selected + 1);
        }*/

            else {
    var selected = $("#tabs").tabs("option", "selected");
    $("#tabs").tabs("option", "selected", selected + 1);
        }
});
$("#nexttab2").click(function() {
    alert("yews");
    if($("#frequency").val()=='Please select frequency')
        {
            alert("select frequency");
        }
    else if($("#e_allergy").val()=='select environmental allergy')
        {
            alert("select environmental allergy");
        }

        else if($("#m_allergy").val()=='select metal allergy')
        {
            alert("select metal allergy");
        }


        else {
    var selected = $("#tabs").tabs("option", "selected");
    $("#tabs").tabs("option", "selected", selected + 1);
        }
});

});

//]]>  

</script>
  <script type='text/javascript' src='js/jquery-1.4.2.js'></script>
  <script type="text/javascript" src="js/jquery-ui.js"></script>




      <link rel="stylesheet" type="text/css"   href="css/jquery-ui.css">



  <style type='text/css'>

  </style>






  <div id="tabs">
        <ul>
            <li><a href="#fragment-1" id="tab_allergy1"><span>Allergy</span></a></li>
            <li><a href="#fragment-2" id="tab_allergy2"><span>Medication</span></a></li>
            <li><a href="#fragment-3"><span>Social History</span></a></li>
        </ul>

        <div id="fragment-1">
            <p><form name="allergy" action="insert_allergies.php" method="post" id="allergy">

     <div id="allergybox" >
        <div id="allergypage1" >

        <div id="allergypage2">        <div id="allergycolor">Food Allergy </div><br>

<select name="food" id="title" class="required">
    <option value="select food allergy">select food allergy</option>
<option value="Eggs">Eggs</option>
<option value="Milk">Milk</option>
<option value="Peanuts">Peanuts</option>
<option value="Fish">Fish</option>
<option value="Shellfish (shrimp, crab, lobster)">Shellfish (shrimp, crab, lobster)</option>
<option value="Soy">Soy</option>
<option value="Tree nuts">Tree nuts</option>
<option value="Wheat">Wheat</option>
<option value="Other gluten-containing food">Other gluten-containing food</option>
<option value="Peanuts">Peanuts</option>
<option value="Tree nuts">Tree nuts</option>
<option value="Corn products">Corn products</option>
<option value="Celery">Celery</option>
<option value="Red meat">Red meat</option>
<option value="Apples">Apples</option>
<option value="Peaches">Peaches</option>
<option value="Strawberries">Strawberries</option>
<option value="Pears">Pears</option>
<option value="Sesame Seeds">Sesame Seeds</option>
<option value="Poppy Seeds">Poppy Seeds</option>
<option value="none">None</option>
<option value="Other" onclick="showOther();">Other</option>
</select>   

  <input type="text" id="otherTitle" name="food1"style="display:none;" />

  </div>

<div id="allergypage3"> <div id="allergycolor">Environmental Allergy </div><br>
 <select name="environment" id="e_allergy" class="required">

<option value="select environmental allergy">select environmental allergy</option>
<option value="Mildew">Mildew</option>
<option value="Molds">Molds</option>
<option value="Dust">Dust</option>
<option value="Fungus spores">Fungus spores</option>
<option value="Food particles">Food particles</option>
<option value="Chemicals & Dyes">Chemicals & Dyes</option>
<option value="Mites">Mites</option>
<option value="Pollen - Tree, Grass, Weed">Pollen - Tree, Grass, Weed</option>
<option value="Animal dander">Animal dander</option>
<option value="Dry skin flakes">Dry skin flakes</option>
<option value="Insect's (cockroaches)">Insect's (cockroaches)</option>
<option value="Insect bites">Insect bites</option>
<option value="Poison ivy or/and other irritating plants">Poison ivy or/and other irritating plants</option>
<option value="Parasites (such as lice)">Parasites (such as lice)</option>
<option value="Soaps and detergents">Soaps and detergents</option>
<option value="Cosmetics">Cosmetics</option>
<option value="Certain foods (especially spicy foods)">Certain foods (especially spicy foods)</option>
<option value="Smoking or Second-hand smoke">Smoking or Second-hand smoke</option>
<option value="Pollution">Pollution</option>
<option value="none">None</option>
<option value="Other" onclick="showOther();">Other</option>
</select>
  <input type="text" name="environment1" id="otherTitle1" style="display:none;" /></div>
<div id="allergypage4"> <div id="allergycolor">Metal Allergy </div>  <br>

<select name="metal" id="m_allergy" class="required">

<option value="select metal allergy">select metal allergy</option>
<option value="Nickel">Nickel</option>
<option value="14K Gold (Nickel part)">14K Gold (Nickel part)</option>
<option value="Platinum">Platinum</option>
<option value="Titanium">Titanium</option>
<option value="Dental Amalgams (silver-colored filling)">Dental Amalgams (silver-colored filling)</option>
<option value="Cobalt">Cobalt</option>
<option value="Chromate">Chromate</option>
<option value="none">None</option>
<option value="Other" onclick="showOther();">Other</option>
</select>
  <input type="text" id="otherTitle2" name="metal1" style="display:none;" /></div>


<script src="js/scripts.js" type="text/javascript"></script>
<div id="allergypage4"> <div id="allergycolor">None </div>  <br>

<select name="metal" id="m_allergy" class="required">

<option value="select metal allergy">select metal allergy</option>
<option value="Nickel">Nickel</option>
<option value="14K Gold (Nickel part)">14K Gold (Nickel part)</option>
<option value="Platinum">Platinum</option>
<option value="Titanium">Titanium</option>
<option value="Dental Amalgams (silver-colored filling)">Dental Amalgams (silver-colored filling)</option>
<option value="Cobalt">Cobalt</option>
<option value="Chromate">Chromate</option>
<option value="none">None</option>
<option value="Other" onclick="showOther();">Other</option>
</select>
  <input type="text" id="otherTitle2" name="metal1" style="display:none;" /></div>
<div id="allergypage4">        <div id="viewallergycolor">
Medication Allergy</div><div class="allergymedicalsearch"><input name="medications" type="text" id="medaller"  size="55" />    
  </div>       <div class="suggestionsBox" id="suggestions" style="display: none;">
        <!--<img src="upArrow.png" style="position: relative; top: -18px; left: 30px;" alt="upArrow" />-->
        <div class="suggestionList" id="autoSuggestionsList"></div>
    </div>
<div id="buttonboxs">
  <div id="save1"><input type="image" src="../images/s1.png" name="save" /></div></div></div></div></div></form></p>
           <br>

 <div style="float:right;"> <a class="nexttab"  style="color:#000;" id="allergy_tab">Next Tab</a></div>
        </div>

        <div id="fragment-2">
<form name="medications" method="post" action="insert_medication.php" >
          <div id="medicalbox">   <div id="medicalboxtitle">Find your Medication:<div class="medicalsearch">
          <input name="search" type="text" id="search" size="75"/>
          <!--<input name="search" type="text" id="search" onblur="fill();"  onkeyup="lookup(this.value);" size="75" />-->
 <input type="button"name="search" id="button" value="Select"/>   </div>       
          </div><div class="suggestionsBox" id="suggestions" style="display: none;">
        <!--<img src="upArrow.png" style="position: relative; top: -18px; left: 30px;" alt="upArrow" />-->
        <div class="suggestionList" id="autoSuggestionsList"></div>
    </div> 

<div class="medicalselected">
        <div id="medicalboxtitle">  Confirm Selection &nbsp; &nbsp;&nbsp;:&nbsp;&nbsp;&nbsp;&nbsp;<input name="med_sel" type="text" id="med_sel" size="75" /><br/></div></div><br>
<br>
<br><br>
<br>
<br>



        <div class="medicalheading"> Instructions :</div><br/><br>
<br>

<div id="medicalbox1"> Frequency :
 <select name="frequency" id="frequency">
         <option value="Please select frequency">Please select frequency</option>
         <option value="Once a day">Once a day </option>
         <option value="2 times a day">2 times a day</option>
         <option value="3 times a day">3 times a day</option>
         <option value="4 times a day ">4 times a day </option>
         <option value="Once every 4 hrs">Once every 4 hrs</option>
         <option value="Once every 6 hrs">Once every 6 hrs</option>
         <option value="Once every 8 hrs">Once every 8 hrs</option>
         <option value="Once every 12 hrs">Once every 12 hrs</option>
         <option value="Once every  24 hrs">Once every  24 hrs</option>
         <option value="Once a week">Once a week</option>
         <option value="Once every 2 weeks">Once every 2 weeks</option>
         <option value="Once every 3 weeks ">Once every 3 weeks </option>
         <option value="Once a month">Once a month</option>
         <option value="Once every alternate day">Once every alternate day</option>
         <option value="Before meals in AM">Before meals in AM</option>
         <option value="After meals in AM">After meals in AM</option>
         <option value="Before meals in PM">Before meals in PM</option>
         <option value="After meals in PM">After meals in PM</option>
         <option value="Before going to bed">Before going to bed</option>
         </select>
         </div>
         <div id="medicalbox2">Route &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<select name="route" >
         <option value="">Please Select oral </option>
         <option value="Oral">Oral</option>
         <option value="Intravenous">Intravenous</option>
         <option value="Intramuscular">Intramuscular</option>
         <option value="Sub-cutaneous">Sub-cutaneous</option>
         <option value="Per Rectal">Per Rectal</option>
         <option value="Inhalation">Inhalation</option>
         </select><br/></div>
<div id="medicalbox3"> Dose/Units&nbsp;&nbsp;
 <input name="dose" type="text" size="12" />&nbsp;&nbsp;<select name="dose1" >

         <option value="mg">mg</option>
         <option value="mcg">mcg</option>
         <option value="gm">gm</option>
         <option value="ml">ml</option>
         <option value="units">units</option>
         </select></div>
         <br>

<div id="medicalbox4"> 
Start Date&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input  id="startdate"  type="text" name="startdate"  /><div style="color:#990000; font-size:12px; font-weight:bold; width:200px; float:right;">yyyy-mm-dd</div></div>
<div id="medicalbox5"> 
End Date&nbsp;&nbsp;&nbsp;
<input  id="enddate" type="text" name="enddate"  /><div style="color:#990000; font-size:12px; font-weight:bold"><div style="color:#990000; font-size:12px; font-weight:bold; width:200px; float:right;">yyyy-mm-dd</div></div>
         <div id="medicalbutton"> <div id="save"><input type="image" src="../images/s1.png" name="save" /></div>
         </div>
         </form>



 </div></div><div style="float:left;">
<div  style="width:630px; float:left;">
     <a class="prttab" href="#" style="color:#000;" >Prive Tab</a>    </div>
 <div style="width:100px;float:right;">
   <a class="nexttab" href="#" style="color:#000;" id="nexttab2">Next Tab</a>        </div>
 </div></div>

        <div id="fragment-3">
          <div id="socialhistoryforms"><div id="socialboxtitle">Social History</div><br>
<br>
<div id="socialq1" ><div id="socialquestion"><b>Do you smoke?</b></div>
<br>
<div id="sociala1">


            <input type="radio" name="smoke" id="smoke_y" value="yes" onclick="return fun1();"/> Yes
             <input type="radio" name="smoke" id="smoke_n" value="no" onclick="return fun1();"/>  no </br></br>

        <div id="hidden" style="display:none;" >  <label > If yes </label>Enter year started<span><input type="text" name="year_started_smoke"  id="year_start" style="display:none" />&nbsp;&nbsp;&nbsp;
       Enter year stopped <input type="text" name="year_stopped_smoke"  id="year_stop" style="display:none" /></span> </div> 
             </br>
         <div id="hidden1" style="display:none"> <label >If presently smokingEnter no of cigarates per day</label ><span> <input type="text" name="present_smoking" style="display:none" id="present_smoking"   size="35" /></span></div>





</div></div>
<div id="socialq1" ><div id="socialquestion"> <b> Do you consume alcohol?</b> </div>
<br>
<div id="sociala1">


            <input type="radio" name="alcohol" id="alcohol_y" value="yes" onclick="return fun1();"/> Yes
             <input type="radio" name="alcohol" id="alcohol_n" value="no" onclick="return fun1();"/>  no </br></br>

     <div id="hidden3" style="display:none;">     If yes Enter year started <input type="text" name="year_started_alcohol"  id="year_start_alcohol" style="display:none"/>
             Enter year stopped<input type="text" name="year_stopped_alcohol"  id="year_stop_alcohol" style="display:none" value=""/></br></br>
            Select <select name="quantity" id="quantity" style="display:none">
             <option value="">select quantity</option>
             <option value="one glasses per day">one glasses per day</option>
             <option value="two glasses per day">two glasses per day</option>
             <option value="three glasses per day">three glasses per day</option>
              <option value="more than three glassesw per day ">more than three glasses per day </option></br>
           </select></div>


</div></div>
<div id="socialq1" ><div id="socialquestion"><b>Do you abuse any substance/drugs?</b></div>
<br>

<div id="sociala1">

 <input type="radio" name="substance" id="substance_y" value="yes" onclick="return fun1();"/> Yes
   <input type="radio" name="substance" id="substance_n" value="no" onclick="return fun1();"/>  no </br></br>

              <div id="hidden4" style="display:none;"> If yes Enter the type of substance abuse<input type="text" name="substance_abuse"  id="substance_abuse" style="display:none"  size="35"/></div>

</div></div>

<div id="socialq1" ><b>Sexual History</b><span style="font-size:13px"> (please provide accurate details, all your medical information will be kept strictly confidential)</span>
  <div id="socialquestion"><br></div>

<div id="sociala1">

Are you a homo Sexual <input type="radio" name="homo_sexual" id="homo_sexual_y" value="yes" onclick="return fun1();"/> Yes
   <input type="radio" name="homo_sexual" id="homo_sexual_n" value="no" onclick="return fun1();"/>  no </br></br>



   Do you use any contracepective device <input type="text" name="contracepective" id="contracepective"  /> </br></br>


  Do you have multiple sexual partners <input type="radio" name="multiple_patners" id="multiple_patners_y" value="yes" onclick="return fun1();"/> Yes
   <input type="radio" name="multiple_patners" id="multiple_patners_n" value="no" onclick="return fun1();"/>  no </br></br>

  Have you ever had any sexualy transmitted disease <input type="radio" name="transmitted_disease" id="transmitted_disease_y" value="yes" onclick="return fun1();"/> Yes
   <input type="radio" name="transmitted_disease" id="transmitted_disease_n" value="no" onclick="return fun1();"/>  no </br></br>

   <input type="submit" value="submit" name="submit">

</div></div></div>
           **<a class="prttab" href="#">Prive Tab</a>**     

这是我面临困难的地方。我希望它以我指定的条件重定向

</div></section>

谢谢

4

1 回答 1

0

你是这个意思吗?

$(document).ready(function(){
    $('a[href="#"]').click(function(){
        event.preventDefault();
    });
}​);​
于 2012-07-24T06:43:36.060 回答