W开发者_如何学Pythonhat I would like to do is show a couple of divs out of a selection so that the user get a almost tailor made page the idea is that there are several divs IE:
<div id="vid1">some content</div>
<div id="vid2">some content</div>
<div id="vid3">some content</div>
so if the user goes to a page with a name like index.html#vid1 it shows the corresponding div but if they go to the same page but through index.html#vid1&vid3 it shows more than one corresponding divs i don't know if the hash tag is the best way to go about this but i am open to any type of system as long as it works properly.
You can get the hash with window.location.hash
and then just split this by the &
character. Then you have an array containing the div names over which you can iterate. With document.getElementById()
you can access the according <div>
and do whatever you want with it
You need to change the display
CSS of the DIV to none
via JavaScript or similar method.
精彩评论