在另一個 frameset 視窗顯示選單

Posted by: 邱小新 at 下午5:50:00 in
createElement() 出來的 innerHTML 無法使用,只能用 innerText 來設定,另外要加上 HTML 必須再使用 el.appendChild() 來加入。
function menu()
{
	amenu = top.frames['view'].document.getElementById("amenu");
	if (amenu == undefined) {
		var el = top.frames['view'].document.createElement("div");
		var view_width=top.frames['view'].document.clientWidth;
		obj = document.getElementById("amenu");
		rect=obj.getBoundingClientRect()
		left=rect.left-255-100+rect.width;
		el.style.cssText = 'position:absolute;left:'+left+
		';top:0;width:100;height:100;opacity:0.3;z-index:100;background:#000;';
		el.id = "amenu";
		top.frames['view'].document.body.appendChild(el);
	}
	else {
		if (amenu.style.visibility == "hidden")
			amenu.style.visibility = "visible";
		else
			amenu.style.visibility = "hidden";
	}
}

Font Awesome

Posted by: 邱小新 at 下午3:06:00 in

Change the color of an SVG element using javascript

Posted by: 邱小新 at 下午4:01:00 in
  • How can I Change the color of an SVG element, through JS??
  • Changing SVG image color with javascript
  • 在 Hover 時更改 SVG 顏色的幾種方式
  • 這個方法可以手動變更 SVG,但是 link 會出錯。
    <a href="javascript:"
    	onmouseover="document.wizard.getSVGDocument().getElementsByTagName('path')[0].style.stroke='white'"
    	onmouseout="document.wizard.getSVGDocument().getElementsByTagName('path')[0].style.stroke=''">
    <object name="wizard" type="image/svg+xml" data="svg/wizard.svg" style="pointer-events: none;"></object>
    </a>
    
  • 這個方法 link 可以正常使用,但是要準備二個 SVG 圖片。
    <a href="javascript:">
    <img width="28" height="28" src="svg/wizard.svg"
    	onmouseenter="this.src='svg/wizard1.svg'"
    	onmouseleave="this.src='svg/wizard.svg'">
    </a>
    

remove a item from array in javascript

Posted by: 邱小新 at 下午6:32:00 in