开发者

iframes and javascript

I have a simple webpage that used a include html file as the left navigation. Here is the code for each button:

<tr><td id="tdIndex" onmouseout="javascript:DoMouseOut(this)" onmouseover="javascript:DoMouseOver(this)"
class="menuDefault" onclick="javascript:NavPage('All_Rooms_Tod开发者_StackOverflow社区ay.html');">All Rooms Overview</td></tr>

Here is the iFrame code on the parent page:

<iframe src="All_Rooms_Today.html" style="width: 100%; height: 500px" scrolling="yes" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0">
</iframe>

I need to write the javascript function navpage to populate the iframe.

Any help will be appreciated.


No need for JavaScript.

<a href="All_Rooms_Today.html" target="name_of_frame">All Rooms Overview</a>

<iframe name="name_of_frame" …>

You can almost certainly replace all the mouseover/out stuff with:

#some_container a {
    display: block;
}

#some_container a:hover {
    background: foo;
    color: bar;
}

If you can't, then you should certainly remove the string javascript: as there is no use in having a label at that point (if you think it means "This is JavaScript", then you're wrong, for intrinsic event attributes you do that with a meta element).

For that matter, frames are a pain for bookmarking and for search engines (among other things). You're already using includes, you should probably keep using them and have proper pages including the navigation instead of framed pages.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜