简体   繁体   中英

Change font size inside a frame with javascript?

I have a html page

<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:

<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.

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:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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