Overiding/Appending querystrings
Just a curiousity rather than an acutal need, I've never thought about this, but I can't think of any html which would do this. I could do it in Javascript or Serverside easy enough, but curious if browers can implement this anyway.
Say I'm at a url: http://www.mysite.com/?param1=10
and I have 开发者_如何转开发an <a>
tag, is there anyway to make it's href so that it will append a new parameter to the qs?
So I could have <a href='?param2=20'>Twenty</a>
which would make the url http://www.mysite.com/?param2=20. But I want it to be http://www.mysite.com/?param1=10¶m2=20. Conversely if I was on http://www.mysite.com/?param1=10¶m2=20 and there was a link to turn the url into http://www.mysite.com/?param1=30¶m2=20, by only specifiying the param1 parameter in the tag? <a href='?param1=20'>10</a>
.
If that makes sense? So can this be done just with html, no js or serverside, and not form submissions, just <a>
tags?
Short answer: no. HTML is not a programming language, just a markup language.
No, it can't be done. Links can be relative to the site (with leading slash):
<a href="/some/page.html">link</a>
or to the page (no slash)
<a href="someotherpage.html">link</a>
they can lead to a local anchor ( with a #)
<a href="#anchorname">link</a>
or they can be absolute
<a href="http://www.mysite.com/foo/bar/phleem.html">link</a>
or of course combinations of the above with local anchors.
But they can't append to the query string.
精彩评论