简体   繁体   English

使用JavaScript更改框架内的字体大小?

[英]Change font size inside a frame with javascript?

I have a html page 我有一个html页面

<html>
<head>
</head>

<frameset cols="*" rows="48,100%" border="0" frameborder="yes" bordercolor="black">
    <frame name="header" src="bar.jsp" scrolling="no" marginheight="0" marginwidth="0" frameborder="0">
    <frame name="body" src="body.jsp" scrolling="auto" marginheight="0" marginwidth="0" frameborder="0">
    <frame>
</frameset>
</HTML>

Inside frame body I have the page body.jsp: 在框架体内,我有页面body.jsp:

<table id="people" width="100%" border="0" cellspacing="8" cellpadding="0">
<tr class='list'>
<td></td>
</tr>
<tr class='list'>
<td></td>
</tr>
</table>

How to change the font size for all rows inside table? 如何更改表中所有行的字体大小?

It looks like your frames are the same domain so thats good. 看起来您的框架是同一个域,那就很好。 What you can do is insert a CSS file onto your frames using javascript, and then target whatever you want. 您可以做的是使用javascript将CSS文件插入框架中,然后根据需要定位。

Something similar to this question: 问题类似:

var cssLink = document.createElement("link");
cssLink.href = "style.css"; 
cssLink .rel = "stylesheet"; 
cssLink .type = "text/css"; 
frames['body'].document.head.appendChild(cssLink);

and in that css file add something like: 然后在该css文件中添加以下内容:

#people tr{
   font-size:12pt;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM