<script> function s_check() { var aaa=document.getElementById("txtHint").innerHTML; alert(aaa); document.getElementById("txtHint").innerHTML="문자열변경"; } </script> </form><p>질문: <span id="txtHint" onclick="s_check()">기본문자열</span></p> =============================================================== 기본문자열을 클릭하면 alert창에 기본 문자열이 나오고 문자열변경으로 내용이 변경 됨니다.
<script> function showHint(str) { // if (str.length==0) // { var aaa=document.getElementById("txtHint").innerHTML; alert(aaa); document.getElementById("txtHint").innerHTML="zzzzzzzz"; // return // } /* xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return } var url="gethint.asp" url=url+"?q="+str url=url+"&sid="+Math.random() xmlHttp.onreadystatechange=stateChanged xmlHttp.open("GET",url,true) xmlHttp.send(null) */ }
</script>
<form> First Name: <input type="text" id="txt1" onkeyup="showHint(this.value)"> </form><p>Suggestions: <span id="txtHint">bbbbbbb</span></p>
======================================================
<SCRIPT> function getID(oObject) { var id = oObject.id; var va=id.value; alert("This object's ID attribute is set to \"" + id + "\"."+va); alert(document.getElementById['aaa']); } </SCRIPT>
<TABLE BORDER COLS=3><TR> <TD ID="firstCell" onclick="getID(this);">Table Cell 1</TD> <TD ID="secondCell" onclick="getID(this);">Table Cell 2</TD> <TD ID="thirdCell" onclick="getID(this);">Table Cell 3</TD> </TR></TABLE> ======================================================
|