php - 使用 Javascript 缩短 html 页面的长度

标签 php javascript html

如果有人能帮忙。我一直在用 html 和 css 开发我的页面。现在我的这个页面变得冗长乏味,无法滚动并获得您想要的内容。我在 css 上使用 :target 标签将页面分成几个部分,但它在某些浏览器上不起作用。我一直在玩 javascript 但没有成功。任何人都可以帮助我处理我应该在页面中使用的 js 脚本,这样当有人加载页面时,它只显示将用作目录的内部链接,当用户单击内部链接时,仅显示该部分与 div 链接显示或弹出?

或者我可以使用 PHP 吗?

 <div>
            <ul>
            <li><a href="#introduction">Introduction to 
antimicrobials</a></li>
            <li><a href="#antifungals">Antifungal Drugs</a></li>
            <li><a href="#antiprotozoals">Antiprotozoal Drugs</a></li>
            <li><a href="#antihelminthics">Antihelminthic Drugs</a></li>
            <li><a href="#antibacterials">Antibacterials</a></li>
            <li><a href="#aminoglycosides">Aminoglycosides</a></li>
            <li><a href="#antifolates">Antifolate Drugs</a></li>
            <li><a href="#fluoroquinolones">Fluoroquinolones</a></li>
            <li><a href="#antimycobacterials">Antimycobacterial 
Drugs</a></li>            

            </ul>

            <div id="introduction">
            Viruses: Smallest pathogens, programmed to infect only certain 
body cells. Virus uses a body cells to reproduce itself it cannot be 
treated with medication.

Bacteria: single celled microorganism, 1000 different bacteria, but 100 
cause disease.
- Bacteria can be treated with antibiotics.
- Some bacteria are becoming immune to certain antibiotics.
- Bacterial Diseases: Strep throat, Tuberculosis Gonorrhea, Syphilis

Fungi: single celled or multicellular plantlike organism
- Fungi can cause diseases of the skin, mucous membrane, and lungs.
- Fungi Diseases: Athlete’s foot, Ringworm, Jock itch, Nail infections, 
Candidiasis</div>



<div id="antifungals">
Amphotericin B continues to be an important drug for the treatment of 
systemic fungal infections. However, several azoles and echinocandins are 
proving to be just as effective in some systemic mycoses with less risk of 
toxic effects.
</div>


<div id="antiprotozoals">
Drugs for Malaria:

Malaria is one of the most common diseases worldwide and a leading cause of 
death. Plasmodium species that infect humans (P falciparum, P malariae, P 
ovale, P vivax) undergo a primary developmental stage in the liver and then 
parasitize erythrocytes. P falciparum and P malariae have only 1 cycle of 
liver cell invasion. The other species have a dormant hepatic stage 
responsible for recurrent infections and relapses. Primary tissue 
schizonticides (eg, primaquine) kill schizonts in the liver, whereas blood 
schizonticides (eg, chloroquine, quinine) kill these parasitic forms only 
in the erythrocyte. Sporonticides (proguanil, pyrimethamine) prevent 
sporogony and multiplication in the mosquito.

Drugs: Chloroquine, Quinine, Mefloquine, Primaquine, pyrimethamine, 
proguanil, Sulfadoxine, Dapsone, Doxycycline, Amodiaquine, Atovaquone, 
Halofantrine, Artesunate, Artemether, Dihydroartemisinin

</div>

<div id="antihelminthics">
Antihelminthic drugs have diverse chemical structures, mechanisms of 
action, and properties. Most were discovered by empiric screening methods; 
many act against specific parasites, and few are devoid of significant 
toxicity to host cells. In addition to the direct toxicity of the drugs, 
reactions to dead and dying parasites may cause serious toxicity in 
patients.
</div>

<div id="antibacterials">
Beta-Lactam Antibiotics & Other Cell Wall Synthesis Inhibitors

Penicillins and cephalosporins are the major antibiotics that inhibit 
bacterial cell wall synthesis. They are called beta-lactams because of the 
unusual 4-member ring that is common to all their members. The beta-lactams 
include some of the most effective, widely used, and well-tolerated agents 
available for the treatment of microbial infections. Vancomycin, 
fosfomycin, and bacitracin also inhibit cell wall synthesis but are not 
nearly as important as the beta-lactam drugs. More than 50 antibiotics that 
act as cell wall synthesis inhibitors are currently available, with 
individual spectra of activity that afford a wide range of clinical 
applications.
</div>

<div id="aminoglycosides">
Aminoglycosides are structurally related amino sugars attached by 
glycosidic linkages. They are polar compounds, not absorbed after oral 
administration and must be given intramuscularly, or intravenously for 
systemic effect. They have limited tissue penetration and do not readily 
cross the blood-brain barrier. Glomerular filtration is the major mode of 
excretion, and plasma levels of these drugs are greatly affected by changes 
in renal function. Excretion of aminoglycosides is directly proportional to 
creatinine clearance. With normal renal function, the elimination half-life 
of aminoglycosides is 2–3 h. Dosage adjustments must be made in renal 
insufficiency to prevent toxic accumulation. Monitoring of plasma levels of 
aminoglycosides is important for safe and effective dosage selection and 
adjustment. For traditional dosing regimens (2 or 3 times daily), peak 
serum levels are measured 30–60 min after administration and trough levels 
just before the next dose. With once-daily dosing, peak levels are less 
important since they will naturally be high.
    </div>

    <div id="fluoroquinolones">
  The fluoroquinolones interfere with bacterial DNA synthesis by inhibiting 
topoisomerase II (DNA gyrase), especially in gram-negative organisms and 
topoisomerase IV, especially in gram-positive organisms. They block the 
relaxation of supercoiled DNA that is catalyzed by DNA gyrase, a step 
required for normal transcription and duplication. Inhibition of 
topoisomerase IV by fluoroquinolones interferes with the separation of 
replicated chromosomal DNA during cell division. Fluoroquinolones are 
usually bactericidal against susceptible organisms. Like aminoglycosides, 
the fluoroquinolones exhibit postantibiotic effects, whereby bacterial 
growth continues to be inhibited even after the plasma concentration of the 
drug has fallen below the minimum inhibitory concentration of the bacterium
</div>

<div id="antimycobacterials">
Drugs for Tuberculosis

The major drugs used in tuberculosis are isoniazid (INH), rifampin, 
ethambutol, pyrazinamide, and streptomycin. Actions of these agents on M 
tuberculosis are bactericidal or bacteriostatic depending on drug 
concentration and strain susceptibility. Appropriate drug treatment 
involves antibiotic susceptibility testing of mycobacterial isolates. 
Initiation of treatment of pulmonary tuberculosis usually involves a 3- or 
4-drug combination regimen depending on the known or anticipated rate of 
resistance to isoniazid (INH). Directly observed therapy (DOT) regimens are 
recommended in noncompliant patients and in drug-resistant tuberculosis.
 </div>  

        </div>

最佳答案

我建议使用 jquery

有一些插件可以轻松处理哈希:

http://www.asual.com/jquery/address/

http://benalman.com/projects/jquery-bbq-plugin/

关于php - 使用 Javascript 缩短 html 页面的长度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15507790/

相关文章:

php - 如何在 Phalcon 中设置 volt 编译目录路径?

php - 使用 CodeIgniter 防止 MS SQL 注入(inject)

javascript - jQuery 3.x 中的 jqXHR 对象是否仍支持 .done 方法?

jquery - 为什么我的 jQuery 按钮在点击时不起作用?

html - 无法在CSS中的搜索表单和菜单之间放置空格

jquery - 如何在 imageMap 的精确坐标处插入一个 div

javascript - jQuery.ajax 不触发

php - 将 MySQL 数据从旧 PHP 应用程序迁移到 Rails 应用程序

javascript - 重新启动javascript setTimeout

javascript - 为什么我的 typescript 文件无法使用 gulp typescript 正确生成为 js?