我试图使用提示变量,并使用提示输入,使html书签,如果这是有意义的,我的代码是在片段,这是因为idk做什么,我有1 - 18章,我需要#C有用户输入的数字,所以idk如何编写必要的代码来做到这一点。提前谢谢你
<!--
<script>
function input(){
var chapter
chapter = prompt("Enter your Chapter: ");
if (chapter =){
}
}
</script>
-->
<p><a href="#C12">Jump to Chapter 12</a></p>
<p><a href="#C10">Jump to Chapter 10</a></p>
<center>
<h2 id="C1">Chapter 1</h2>
<p>Once upon a midnight dreary, while I pondered, weak and weary,<br>
Over many a quaint and curious volume of forgotten lore—<br>
While I nodded, nearly napping, suddenly there came a tapping,<br>
As of some one gently rapping, rapping at my chamber door.<br>
“’Tis some visitor,” I muttered, “tapping at my chamber door—<br>
Only this and nothing more.”</p>
<h2 id="C2">Chapter 2</h2>
<p>Ah, distinctly I remember it was in the bleak December;<br>
And each separate dying ember wrought its ghost upon the floor.<br>
Eagerly I wished the morrow;—vainly I had sought to borrow<br>
From my books surcease of sorrow—sorrow for the lost Lenore—<br>
For the rare and radiant maiden whom the angels name Lenore—<br>
Nameless here for evermore.</p>
<h2 id="C3">Chapter 3</h2>
<p>And the silken, sad, uncertain rustling of each purple curtain<br>
Thrilled me—filled me with fantastic terrors never felt before;<br>
So that now, to still the beating of my heart, I stood repeating<br>
“’Tis some visitor entreating entrance at my chamber door—<br>
Some late visitor entreating entrance at my chamber door;—<br>
This it is and nothing more.”</p>
<h2 id="C4">Chapter 4</h2>
<p>Presently my soul grew stronger; hesitating then no longer,<br>
“Sir,” said I, “or Madam, truly your forgiveness I implore;<br>
But the fact is I was napping, and so gently you came rapping,<br>
And so faintly you came tapping, tapping at my chamber door,<br>
That I scarce was sure I heard you”—here I opened wide the door;—<br>
Darkness there and nothing more.</p>
<h2 id="C5">Chapter 5</h2>
<p>Deep into that darkness peering, long I stood there wondering, fearing,<br>
Doubting, dreaming dreams no mortal ever dared to dream before;<br>
But the silence was unbroken, and the stillness gave no token,<br>
And the only word there spoken was the whispered word, “Lenore?”<br>
This I whispered, and an echo murmured back the word, “Lenore!”—<br>
Merely this and nothing more.</p>
<h2 id="C6">Chapter 6</h2>
<p>Back into the chamber turning, all my soul within me burning,<br>
Soon again I heard a tapping somewhat louder than before.<br>
“Surely,” said I, “surely that is something at my window lattice;<br>
Let me see, then, what thereat is, and this mystery explore—<br>
Let my heart be still a moment and this mystery explore;—<br>
’Tis the wind and nothing more!”</p>
<h2 id="C7">Chapter 7</h2>
<p>Open here I flung the shutter, when, with many a flirt and flutter,<br>
In there stepped a stately Raven of the saintly days of yore;<br>
Not the least obeisance made he; not a minute stopped or stayed he;<br>
But, with mien of lord or lady, perched above my chamber door—<br>
Perched upon a bust of Pallas just above my chamber door—<br>
Perched, and sat, and nothing more.</p>
<h2 id="C8">Chapter 8</h2>
<p>Then this ebony bird beguiling my sad fancy into smiling,<br>
By the grave and stern decorum of the countenance it wore,<br>
“Though thy crest be shorn and shaven, thou,” I said, “art sure no craven,<br>
Ghastly grim and ancient Raven wandering from the Nightly shore—<br>
Tell me what thy lordly name is on the Night’s Plutonian shore!”<br>
Quoth the Raven “Nevermore.”</p>
<h2 id="C9">Chapter 9</h2>
<p>Much I marvelled this ungainly fowl to hear discourse so plainly,<br>
Though its answer little meaning—little relevancy bore;<br>
For we cannot help agreeing that no living human being<br>
Ever yet was blessed with seeing bird above his chamber door—<br>
Bird or beast upon the sculptured bust above his chamber door,<br>
With such name as “Nevermore.”
</p>
<h2 id="C10">Chapter 10</h2>
<p> But the Raven, sitting lonely on the placid bust, spoke only<br>
That one word, as if his soul in that one word he did outpour.<br>
Nothing farther then he uttered—not a feather then he fluttered—<br>
Till I scarcely more than muttered “Other friends have flown before—<br>
On the morrow he will leave me, as my Hopes have flown before.”<br>
Then the bird said “Nevermore.”</p>
<h2 id="C11">Chapter 11</h2>
<p>Startled at the stillness broken by reply so aptly spoken,<br>
“Doubtless,” said I, “what it utters is its only stock and store<br>
Caught from some unhappy master whom unmerciful Disaster<br>
Followed fast and followed faster till his songs one burden bore—<br>
Till the dirges of his Hope that melancholy burden bore<br>
Of ‘Never—nevermore’.”
</p>
<h2 id="C12">Chapter 12</h2>
<p>But the Raven still beguiling all my fancy into smiling,<br>
Straight I wheeled a cushioned seat in front of bird, and bust and door;<br>
Then, upon the velvet sinking, I betook myself to linking<br>
Fancy unto fancy, thinking what this ominous bird of yore—<br>
What this grim, ungainly, ghastly, gaunt, and ominous bird of yore<br>
Meant in croaking “Nevermore.”
</p>
<h2 id="C13">Chapter 13</h2>
<p>This I sat engaged in guessing, but no syllable expressing<br>
To the fowl whose fiery eyes now burned into my bosom’s core;<br>
This and more I sat divining, with my head at ease reclining<br>
On the cushion’s velvet lining that the lamp-light gloated o’er,<br>
But whose velvet-violet lining with the lamp-light gloating o’er,<br>
She shall press, ah, nevermore!
</p>
<h2 id="C14">Chapter 14</h2>
<p>Then, methought, the air grew denser, perfumed from an unseen censer<br>
Swung by Seraphim whose foot-falls tinkled on the tufted floor.<br>
“Wretch,” I cried, “thy God hath lent thee—by these angels he hath sent thee<br>
Respite—respite and nepenthe from thy memories of Lenore;<br>
Quaff, oh quaff this kind nepenthe and forget this lost Lenore!”<br>
Quoth the Raven “Nevermore.”</p>
<h2 id="C15">Chapter 15</h2>
<p>“Prophet!” said I, “thing of evil!—prophet still, if bird or devil!—<br>
Whether Tempter sent, or whether tempest tossed thee here ashore,<br>
Desolate yet all undaunted, on this desert land enchanted—<br>
On this home by Horror haunted—tell me truly, I implore—<br>
Is there—is there balm in Gilead?—tell me—tell me, I implore!”<br>
Quoth the Raven “Nevermore.”
</p>
<h2 id="C16">Chapter 16</h2>
<p> “Prophet!” said I, “thing of evil!—prophet still, if bird or devil!<br>
By that Heaven that bends above us—by that God we both adore—<br>
Tell this soul with sorrow laden if, within the distant Aidenn,<br>
It shall clasp a sainted maiden whom the angels name Lenore—<br>
Clasp a rare and radiant maiden whom the angels name Lenore.”<br>
Quoth the Raven “Nevermore.”</p>
<h2 id="C17">Chapter 17</h2>
<p>“Be that word our sign of parting, bird or fiend!” I shrieked, upstarting—<br>
“Get thee back into the tempest and the Night’s Plutonian shore!<br>
Leave no black plume as a token of that lie thy soul hath spoken!<br>
Leave my loneliness unbroken!—quit the bust above my door!<br>
Take thy beak from out my heart, and take thy form from off my door!”<br>
Quoth the Raven “Nevermore.”</p>
<h2 id="C18">Chapter 18</h2>
<p>And the Raven, never flitting, still is sitting, still is sitting<br>
On the pallid bust of Pallas just above my chamber door;<br>
And his eyes have all the seeming of a demon’s that is dreaming,<br>
And the lamp-light o’er him streaming throws his shadow on the floor;<br>
And my soul from out that shadow that lies floating on the floor<br>
Shall be lifted—nevermore!</p>
</center>
试试这个:
let Chapter = prompt('Jump to chapter:');
window.location.hash = "C" + Chapter;
<p><a href="#C12">Jump to Chapter 12</a></p>
<p><a href="#C10">Jump to Chapter 10</a></p>
<center>
<h2 id="C1">Chapter 1</h2>
<p>Once upon a midnight dreary, while I pondered, weak and weary,<br>
Over many a quaint and curious volume of forgotten lore—<br>
While I nodded, nearly napping, suddenly there came a tapping,<br>
As of some one gently rapping, rapping at my chamber door.<br>
“’Tis some visitor,” I muttered, “tapping at my chamber door—<br>
Only this and nothing more.”</p>
<h2 id="C2">Chapter 2</h2>
<p>Ah, distinctly I remember it was in the bleak December;<br>
And each separate dying ember wrought its ghost upon the floor.<br>
Eagerly I wished the morrow;—vainly I had sought to borrow<br>
From my books surcease of sorrow—sorrow for the lost Lenore—<br>
For the rare and radiant maiden whom the angels name Lenore—<br>
Nameless here for evermore.</p>
<h2 id="C3">Chapter 3</h2>
<p>And the silken, sad, uncertain rustling of each purple curtain<br>
Thrilled me—filled me with fantastic terrors never felt before;<br>
So that now, to still the beating of my heart, I stood repeating<br>
“’Tis some visitor entreating entrance at my chamber door—<br>
Some late visitor entreating entrance at my chamber door;—<br>
This it is and nothing more.”</p>
<h2 id="C4">Chapter 4</h2>
<p>Presently my soul grew stronger; hesitating then no longer,<br>
“Sir,” said I, “or Madam, truly your forgiveness I implore;<br>
But the fact is I was napping, and so gently you came rapping,<br>
And so faintly you came tapping, tapping at my chamber door,<br>
That I scarce was sure I heard you”—here I opened wide the door;—<br>
Darkness there and nothing more.</p>
<h2 id="C5">Chapter 5</h2>
<p>Deep into that darkness peering, long I stood there wondering, fearing,<br>
Doubting, dreaming dreams no mortal ever dared to dream before;<br>
But the silence was unbroken, and the stillness gave no token,<br>
And the only word there spoken was the whispered word, “Lenore?”<br>
This I whispered, and an echo murmured back the word, “Lenore!”—<br>
Merely this and nothing more.</p>
<h2 id="C6">Chapter 6</h2>
<p>Back into the chamber turning, all my soul within me burning,<br>
Soon again I heard a tapping somewhat louder than before.<br>
“Surely,” said I, “surely that is something at my window lattice;<br>
Let me see, then, what thereat is, and this mystery explore—<br>
Let my heart be still a moment and this mystery explore;—<br>
’Tis the wind and nothing more!”</p>
<h2 id="C7">Chapter 7</h2>
<p>Open here I flung the shutter, when, with many a flirt and flutter,<br>
In there stepped a stately Raven of the saintly days of yore;<br>
Not the least obeisance made he; not a minute stopped or stayed he;<br>
But, with mien of lord or lady, perched above my chamber door—<br>
Perched upon a bust of Pallas just above my chamber door—<br>
Perched, and sat, and nothing more.</p>
<h2 id="C8">Chapter 8</h2>
<p>Then this ebony bird beguiling my sad fancy into smiling,<br>
By the grave and stern decorum of the countenance it wore,<br>
“Though thy crest be shorn and shaven, thou,” I said, “art sure no craven,<br>
Ghastly grim and ancient Raven wandering from the Nightly shore—<br>
Tell me what thy lordly name is on the Night’s Plutonian shore!”<br>
Quoth the Raven “Nevermore.”</p>
<h2 id="C9">Chapter 9</h2>
<p>Much I marvelled this ungainly fowl to hear discourse so plainly,<br>
Though its answer little meaning—little relevancy bore;<br>
For we cannot help agreeing that no living human being<br>
Ever yet was blessed with seeing bird above his chamber door—<br>
Bird or beast upon the sculptured bust above his chamber door,<br>
With such name as “Nevermore.”
</p>
<h2 id="C10">Chapter 10</h2>
<p> But the Raven, sitting lonely on the placid bust, spoke only<br>
That one word, as if his soul in that one word he did outpour.<br>
Nothing farther then he uttered—not a feather then he fluttered—<br>
Till I scarcely more than muttered “Other friends have flown before—<br>
On the morrow he will leave me, as my Hopes have flown before.”<br>
Then the bird said “Nevermore.”</p>
<h2 id="C11">Chapter 11</h2>
<p>Startled at the stillness broken by reply so aptly spoken,<br>
“Doubtless,” said I, “what it utters is its only stock and store<br>
Caught from some unhappy master whom unmerciful Disaster<br>
Followed fast and followed faster till his songs one burden bore—<br>
Till the dirges of his Hope that melancholy burden bore<br>
Of ‘Never—nevermore’.”
</p>
<h2 id="C12">Chapter 12</h2>
<p>But the Raven still beguiling all my fancy into smiling,<br>
Straight I wheeled a cushioned seat in front of bird, and bust and door;<br>
Then, upon the velvet sinking, I betook myself to linking<br>
Fancy unto fancy, thinking what this ominous bird of yore—<br>
What this grim, ungainly, ghastly, gaunt, and ominous bird of yore<br>
Meant in croaking “Nevermore.”
</p>
<h2 id="C13">Chapter 13</h2>
<p>This I sat engaged in guessing, but no syllable expressing<br>
To the fowl whose fiery eyes now burned into my bosom’s core;<br>
This and more I sat divining, with my head at ease reclining<br>
On the cushion’s velvet lining that the lamp-light gloated o’er,<br>
But whose velvet-violet lining with the lamp-light gloating o’er,<br>
She shall press, ah, nevermore!
</p>
<h2 id="C14">Chapter 14</h2>
<p>Then, methought, the air grew denser, perfumed from an unseen censer<br>
Swung by Seraphim whose foot-falls tinkled on the tufted floor.<br>
“Wretch,” I cried, “thy God hath lent thee—by these angels he hath sent thee<br>
Respite—respite and nepenthe from thy memories of Lenore;<br>
Quaff, oh quaff this kind nepenthe and forget this lost Lenore!”<br>
Quoth the Raven “Nevermore.”</p>
<h2 id="C15">Chapter 15</h2>
<p>“Prophet!” said I, “thing of evil!—prophet still, if bird or devil!—<br>
Whether Tempter sent, or whether tempest tossed thee here ashore,<br>
Desolate yet all undaunted, on this desert land enchanted—<br>
On this home by Horror haunted—tell me truly, I implore—<br>
Is there—is there balm in Gilead?—tell me—tell me, I implore!”<br>
Quoth the Raven “Nevermore.”
</p>
<h2 id="C16">Chapter 16</h2>
<p> “Prophet!” said I, “thing of evil!—prophet still, if bird or devil!<br>
By that Heaven that bends above us—by that God we both adore—<br>
Tell this soul with sorrow laden if, within the distant Aidenn,<br>
It shall clasp a sainted maiden whom the angels name Lenore—<br>
Clasp a rare and radiant maiden whom the angels name Lenore.”<br>
Quoth the Raven “Nevermore.”</p>
<h2 id="C17">Chapter 17</h2>
<p>“Be that word our sign of parting, bird or fiend!” I shrieked, upstarting—<br>
“Get thee back into the tempest and the Night’s Plutonian shore!<br>
Leave no black plume as a token of that lie thy soul hath spoken!<br>
Leave my loneliness unbroken!—quit the bust above my door!<br>
Take thy beak from out my heart, and take thy form from off my door!”<br>
Quoth the Raven “Nevermore.”</p>
<h2 id="C18">Chapter 18</h2>
<p>And the Raven, never flitting, still is sitting, still is sitting<br>
On the pallid bust of Pallas just above my chamber door;<br>
And his eyes have all the seeming of a demon’s that is dreaming,<br>
And the lamp-light o’er him streaming throws his shadow on the floor;<br>
And my soul from out that shadow that lies floating on the floor<br>
Shall be lifted—nevermore!</p>
</center>
所有的标签都以C开头,要滚动到带有标签的元素,可以使用
window.location.hash