2013-10-14 6 views
0

나는 HTML을 통해 iframe을 배치하는 방법을 알고 있지만 자바 스크립트는 북마클릿을 만들고 있습니다.어떻게 북마클릿으로 자바 스크립트 코드를 통해 iframe을 배치합니까

는이 질문의 두번째 대답에서 교훈을 추정했습니다 Bookmarklet: Append hidden iframe to page and load url

이 마련 : 그것은 무엇의 스크린 샷이다

javascript:var%20ifra=document.createElement('iframe');ifra.src="https://imanerd11.kd.io/temp1.html";ifra.setAttribute("width","194");ifra.setAttribute("height","750");ifra.setAttribute("left","0");ifra.setAttribute("borders","no");ifra.setAttribute("scrollbars","no");ifra.setAttribute("top","0");void(document.body.appendChild(ifra));

enter image description here

  • 현재.

나는이 같은 페이지 측면이 이동 할 수 있어야합니다 :

enter image description here

답변

0

topleft는 속성 수없는, 그들은 CSS의 속성입니다.

ifra.setAttribute('style', 'top: 10px; left: 10px;'); 

참고 :

ifra.style.top = '100px'; 

당신은 또한 스타일 속성을 사용할 수 있습니다

당신은 같은 프로그래밍 스타일을 설정할 수 있습니다이 무시된다는 것을 잊지 마세요을 경우 요소 ISIN ' 위치는 절대 또는 상대입니다.