ThaiSEOBoard.com

พัฒนาเว็บไซต์ => Programming => ข้อความที่เริ่มโดย: น้องบิ้ว ที่ 12 สิงหาคม 2013, 01:52:45



หัวข้อ: # ใครเก่งช่วยทีคับ มีวิธีใส่ CSS เปลี่ยนรูปแบบ font ของเว็บอื่นที่เราดึงมาเป็น iframe ได้ไหมคับ
เริ่มหัวข้อโดย: น้องบิ้ว ที่ 12 สิงหาคม 2013, 01:52:45
ดีครับ ตามหัวข้อเลยคับ ผมกำลังหาวิธีใส่ css คือเปลี่ยนรูปแบบ font ของเว็บอื่น ที่เราดึงมาเป็น iframe มาแปะเว็บเราได้ไหมคับ เข้าใจง่ายๆคือผมไม่ชอบรูปแบบของเว็บนั้นอยากจะเปลี่ยนสี

อย่างผมจะดึง หน้านี้ http://www.welovethailand.com/Show_iframe_ssi_recentTopics3.php  รูปแบบต้นฉบับเป็นฟอนสีน้ำเงิน

แล้วมาแปะที่เว็บผม mydomain.com  ผมก็วางโค้ดด้านล่างนี้  แต่ผมอยากเปลี่ยนรูปแบบฟอนส์ สี และขนาดตัวอักษร เราสามารถใส่ css คลุม iframe ได้ไหมคับ ผมลองทำแล้วมันไม่เป็นผลไม่รู้ใช้วิธีอะไรนะคับ มันเป็นเว็บของคนอื่นนะคับ แต่เราอยากเปลี่ยน style มันมีวิธีไหมคับ ถ้ามีรบกวนช่วยแนะนำทีคับ ขอบคุณล่วงหน้าคับ

<iframe src="http://www.welovethailand.com/Show_iframe_ssi_recentTopics3.php"  width="100%" marginwidth="0" height="500" marginheight="0" scrolling="No" frameborder="0"></iframe>

 :wanwan017:


หัวข้อ: Re: # ใครเก่งช่วยทีคับ มีวิธีใส่ CSS เปลี่ยนรูปแบบ font ของเว็บอื่นที่เราดึงมาเป็น iframe ได้ไหมคับ
เริ่มหัวข้อโดย: kiraoji ที่ 12 สิงหาคม 2013, 08:37:43
1 ไม่ลองใส่ Css Class ใน iframe และ ใส่ style
2  ใส่ css style ใน head  ของเว็บเรา

ไม่ชัวลองดูครับ


หัวข้อ: Re: # ใครเก่งช่วยทีคับ มีวิธีใส่ CSS เปลี่ยนรูปแบบ font ของเว็บอื่นที่เราดึงมาเป็น iframe ได้ไหมคับ
เริ่มหัวข้อโดย: 969 ที่ 12 สิงหาคม 2013, 09:30:01
ทำได้เหรอครับ ถ้าทำได้แจ่มเลย
 :wanwan004:


หัวข้อ: Re: # ใครเก่งช่วยทีคับ มีวิธีใส่ CSS เปลี่ยนรูปแบบ font ของเว็บอื่นที่เราดึงมาเป็น iframe ได้ไหมคับ
เริ่มหัวข้อโดย: max30012540 ที่ 12 สิงหาคม 2013, 10:40:56
ทำได้ครับ แต่จะทำไม่ได้กับ Cross domain
อ้างถึง
Edit: This does not work cross domain.

There are two different things here: the style of the iframe block and the style of the page embedded in the iframe. You can set the style of the iframe block the usual way:

โค๊ด:
<iframe name='iframe1' id="iframe1" src="empty.htm" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
The style of the page embedded in the iframe must be either set by including it in the child page:

โค๊ด:
<link type="text/css" rel="Stylesheet" href="Style/simple.css" />
Or it can be loaded from the parent page with Javascript:

โค๊ด:
var cssLink = document.createElement("link") 
cssLink.href = "style.css";
cssLink .rel = "stylesheet";
cssLink .type = "text/css";
frames['frame1'].document.body.appendChild(cssLink);

http://stackoverflow.com/questions/217776/how-to-apply-css-to-iframe

ต้องใช้ Php ดึงมา แล้วตัดเอาส่วนที่ต้องการออกมาครับ  :-[


หัวข้อ: Re: # ใครเก่งช่วยทีคับ มีวิธีใส่ CSS เปลี่ยนรูปแบบ font ของเว็บอื่นที่เราดึงมาเป็น iframe ได้ไหมคับ
เริ่มหัวข้อโดย: น้องบิ้ว ที่ 12 สิงหาคม 2013, 23:09:12
ทำได้ครับ แต่จะทำไม่ได้กับ Cross domain
อ้างถึง
Edit: This does not work cross domain.

There are two different things here: the style of the iframe block and the style of the page embedded in the iframe. You can set the style of the iframe block the usual way:

โค๊ด:
<iframe name='iframe1' id="iframe1" src="empty.htm" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
The style of the page embedded in the iframe must be either set by including it in the child page:

โค๊ด:
<link type="text/css" rel="Stylesheet" href="Style/simple.css" />
Or it can be loaded from the parent page with Javascript:

โค๊ด:
var cssLink = document.createElement("link") 
cssLink.href = "style.css";
cssLink .rel = "stylesheet";
cssLink .type = "text/css";
frames['frame1'].document.body.appendChild(cssLink);

[url]http://stackoverflow.com/questions/217776/how-to-apply-css-to-iframe[/url]

ต้องใช้ Php ดึงมา แล้วตัดเอาส่วนที่ต้องการออกมาครับ  :-[


ขอบคุณมากคับ เด๋วขอลองก่อนคับ  แต่ว่าของผมคือ คนละโดเมนนะคับ ไม่รุจะได้ไหม  :P