시계소스 좀 봐 주세요.

ant01의 이미지

아래는 책에 있는 소스인데요, 상태표시줄에 아무 메시지가 나오질 않습니다.
어디가 잘못된 것일까요?

<html>
<head>
<script language="javascript">
 
<!---
function showTime(){
	now=new Data();
	hours=now.gethours();
	minutes-now.getMinutes();
	seconds=now.getSeconds();
	clock=" 연습";
	windows.status=clock;
}
//-->
</script>
</head>
<body onLoad=setInterval("showTime()",1000)>
<center>
<h3>* setTimeout Method * </h3><hr>
상태 바
</center>
</body>
</html>
chisquare88의 이미지

스펠링도 틀렸고 대소문자도 안지켜줬습니다.

스크립트를 주석형식으로 하는것은 IE4.0 이하시절(약 15년전) 자바스크립트를 지원하지 않는 브라우저를 위해쓰던 편법으로 지금은 주석처리 하지 않는것을 권장합니다.

[geshifilter-html]&#10;&lt;head&gt;&#10;&lt;script language=&quot;javascript&quot;&gt;&#10;function showTime(){&#10;	now=new Date();&#10;	hours=now.getHours();&#10;	minutes=now.getMinutes();&#10;	seconds=now.getSeconds();&#10;	clock=hours + &quot;&quot; + minutes +&quot;&quot; + seconds + &quot;&quot;&#10;	document.getElementById(&quot;foo&quot;).innerHTML=clock;&#10;}&#10;&lt;/script&gt;&#10;&lt;/head&gt;&#10;&lt;body onLoad=setInterval(&quot;showTime()&quot;,1000)&gt;&#10;&lt;center&gt;&#10;&lt;h3&gt;* setTimeout Method * &lt;/h3&gt;&lt;hr&gt;&#10;상태 바&#10;&lt;p id=&quot;foo&quot;&gt;&lt;p&gt;&#10;&lt;/center&gt;&#10;&lt;/body&gt;&#10;[/geshifilter-html]

χxχ=χ^2
GIS SW 개발자

ant01의 이미지

질문의 요지는

windows.status=clock;

이 작동하지 않는다는 것입니다. 어떻케 해야 작동할까요?
그리고 제가 보는 책 등에는
document.getElementById("foo").innerHTML=clock;

이런 식의 표현이 없던데 잘 작동하더군요. 이런 것은 어디서 배울 수 있나요?
chisquare88의 이미지

크롬과 파이어폭스,IE 최신판 등 현대의 브라우저들은 기본적으로 상태표시바가 없거나 숨겨놓습니다. 그래서 브라우저 별로 제대로 작동하지 않을 수 도 있습니다.

그리고 이런식의 표현이 없다고 하시는거 보면 아직 자바스크립트를 이해하지 못하신거 같습니다. 자바스크립트 관력 서적을 한번정도는 읽어주시면 좋겠네요.

아주 기초적인거에요.

혹시 JQuery를 사용해보셨다면. $('.id')와 같은 겁니다.

χxχ=χ^2
GIS SW 개발자

ant01의 이미지

그런데도 안되네요.

익명 사용자의 이미지

http://www.w3schools.com/jsref/prop_win_status.asp

오페라에서만 되는군요. 다른 브라우저에서는 사용자가 옵션을 바꿔줘야 작동한다고 되어있네요.
그냥 안쓰는 것이 좋겠습니다.

chisquare88의 이미지

Head First Javascript를 추천합니다.

χxχ=χ^2
GIS SW 개발자

ant01의 이미지

영어는 부딤스러워서요.

winner의 이미지

다만 IE 쓰시는 분들께는 추천할 수가 없습니다. Firefox 전용 keyword 인 const 가 나오더군요.
진지하게 해보고 싶다면 JavaScript 완벽가이드를 추천합니다.
자바스크립트 for Web 2.0 도 좋습니다. 얇은 편이거든요.
http://blog.naver.com/PostView.nhn?blogId=agapeuni&logNo=60126572583

ant01의 이미지

javascript 완벽가이드는 이전에도 알아보았는 데 절판이고
자바스크립트 for web 2.0 알아보아야 겠네요...

ant01의 이미지

1월 22일 개정판이 별책과 함께 세트로 판매 되는군요...

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.