Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私は2つのページを持っています.1番目にはdivが含まれ、2番目のページにはいくつかの画像が含まれています.ユーザーが2番目のページの画像をクリックすると、ページが最初のページにリダイレクトされ、選択された画像が最初のページのdivに入るという機能があります.
HTML5セッションストレージを介してこれをどのように達成できますか??
ユーザーを最初のページに移動する前に、 を設定しsessionStorage.imageclicked = [whatever image was clicked here]ます。次に、その値を取得し、それを使用して画像を表示します。
sessionStorage.imageclicked = [whatever image was clicked here]
では、通常のリンクを使用しないのはなぜですか?
http://example.com/firstpage.ext?image=[whatever image was clicked]
これは、最も古いブラウザでもサポートされています。