作者lccf (~(⊙o⊙)~)
看板PHP
標題[問題] iframe focus問題
時間Mon Oct 18 10:35:34 2010
想請問一下
如果我希望可以當按下一個圖片時,他就會插入到iframe裡面
然後希望接下來滑鼠游標是自動在iframe那張圖片後,
不用從新再用滑鼠點一次iframe做focus動作
以方便使用者繼續按下他要插入的圖片
不過目前不太曉得要從哪邊加入focus動作
麻煩幫我看一下哪邊有問題
謝謝
<html>
<head>
<script language="javascript">
function wysiwyg_editor_init(){
document.getElementById("wysiwyg_editor").contentDocument.designMode="on";
document.getElementById("wysiwyg_editor").focus();
}
setTimeout("wysiwyg_editor_init()", 1000);
function fun(str)
{
var selection = window.frames["wysiwyg_editor"].getSelection();
var imgElement = document.createElement("img");
imgElement.src=str;
selection.getRangeAt(0).surroundContents(imgElement);
}
</script>
</head>
<body>
<form name="editor_form">
<iframe height="200" width="500" name="wysiwyg_editor" id="wysiwyg_editor" ">
</iframe>
<br>
<div style="width:350px;">
<img src="../images/getTTF1.gif" width="40" height="40" class="img1"
onClick="fun(this.src);" style="cursor:pointer;"/>
</div>
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.109.16.211
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.109.16.211
※ 編輯: lccf 來自: 140.109.16.211 (10/18 10:32)
※ 編輯: lccf 來自: 140.109.16.211 (10/18 10:35)
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.109.16.211
※ 編輯: lccf 來自: 140.109.16.211 (10/18 10:36)
→ guardlan:你應該去javascript板...XD 10/18 11:35
推 kalecgos0616:請洽Web_Design 10/18 11:49