开发者

double action link

开发者 https://www.devze.com 2022-12-18 17:15 出处:网络
Can I create a link that has another link in html. For example, I want to call an html form and the target will be the sidebar frame.

Can I create a link that has another link in html. For example, I want to call an html form and the target will be the sidebar frame. At the same time, the board frame will 开发者_JAVA百科also go back to the previous page.


I don't think you would be able to do this in plain HTML, but you could probably use JavaScript to accomplish what you're after.


as steve mentioned you need a bit of javascript:
<iframe id="frame1"></iframe>
<a href="" onclick="update();return false;" >DoubleActionLink</a>
<script>
function update() {
window.open("http://www.stackoverflow.com"); parent.document.getElementById('frame1').src="http://www.w3c.org"; }
</script>

btw, you said

I want to call an html form

html form means you'll submit something to web server...so you aren't asking for pure html solution. Isn't ?


The w3 specification about links clearly states that this is forbidden ..

12.2.2 Nested links are illegal

Links and anchors defined by the A element must not be nested; an A element must not contain any other A elements.

But you can handle the click event through javascript and do additional actions when clicked..


Use target="_top" and set the href to the URL of a <frameset> document which loads all the frames you want by default.

Better yet, don't use frames. They are more trouble than they are worth.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号