2012년 1월 30일 월요일

[android] 최강안드로이드 책 코드 발췌(2012. 01. 30)

1. android:background="@android:drawable/editbox_background"/>
2. FrameLayout mContentView = (FrameLayout)getWindow().getDecorView().findViewById(android.R.id.content);
3. final View zoom = mWebView.getZoomControls();    zoom.getTouchables().get(0).setOnClickListener(new OnClickListener(){
4. ABC<sup>+</sup>
5.     static final String[] CONTACTS_SUMMARY_PROJECTION = new String[] {
        Contacts._ID,
        Contacts.DISPLAY_NAME,
        Contacts.CONTACT_STATUS,
        Contacts.CONTACT_PRESENCE,
        Contacts.PHOTO_ID,
        Contacts.LOOKUP_KEY,
    };
        Cursor cursor = getContentResolver().query(Contacts.CONTENT_URI,
        CONTACTS_SUMMARY_PROJECTION, null, null, null);
        startManagingCursor(cursor);
       
        SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(this,
               android.R.layout.simple_list_item_2, cursor,
                new String[] { Contacts.DISPLAY_NAME, Contacts.CONTACT_STATUS },
                new int[] { android.R.id.text1, android.R.id.text2 });

        setListAdapter(mAdapter);
6.     onLayout()에서 호출함
view spoof, view original
       현재 레이아웃 스크린 좌표 얻기
        final int[] globalPos = new int[2];
        spoof.getLocationOnScreen(globalPos);
        레이이아웃에 위치를 지정해 주기
spoof.layout(x, y, x + original.getWidth(), y + original.getHeight());

onMeasure(int, int) Called to determine the size requirements for this view and all of its children.
onLayout(boolean, int, int, int, int)

private void showOverlay() {
       ToastViewOverlay overlay = (ToastViewOverlay)
               getLayoutInflater().inflate(R.layout.secure_view_overlay, null);
       overlay.setActivityToSpoof(this);
     
       Toast toast = new Toast(getApplicationContext());
       toast.setGravity(Gravity.FILL, 0, 0);
       toast.setDuration(Toast.LENGTH_LONG);
       toast.setView(overlay);
       toast.show();
   }
7.
int timeout = 10000;
       
        SocketAddress socketAddress = new InetSocketAddress("192.168.10.77", 6001);
sock = new Socket();
       
   sock.setReceiveBufferSize(64000);
   sock.setSoTimeout(30000);
   sock.setSoLinger(true, timeout);
   sock.connect(socketAddress, timeout);

PrintWriter out = new PrintWriter( new
BufferedWriter( new OutputStreamWriter(sock.getOutputStream())),true);
out.println(message);
// sleep(20000);
BufferedReader input = new BufferedReader(new InputStreamReader(sock.getInputStream()));
     
String st = input.readLine();
8.      // setTheme(android.R.style.Theme);
        // setTheme(android.R.style.Theme_Light);
        // setTheme(R.style.Theme_Translucent);
        setTheme(R.style.Theme_Transparent);
        setContentView(R.layout.main);
9.  public static final String testContent = "<html><body><b>HTML 문서를 TextView에 출력합니다.</b><font size='+1'>크게</font>"
    + "<img src=\"http://developer.android.com/assets/images/home/honeycomb-android.png\"/></body></html>";
    tvText.setText(Html.fromHtml(testContent, imgGetter, null));
    private final ImageGetter imgGetter = new ImageGetter() {
@Override
public Drawable getDrawable(String source) {
HttpGet get = new HttpGet(source);
DefaultHttpClient client = new DefaultHttpClient();
Drawable drawable = null;
try {
HttpResponse response = client.execute(get);
StatusLine status = response.getStatusLine();

if (status.getStatusCode() != 200)
return null;

InputStream stream = response.getEntity().getContent();
   File path = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES);      
   File file = new File(path, "HtmlPicture.png");
FileOutputStream fileout = new FileOutputStream(file);
byte buf[] = new byte[8192];
int len;

while ((len =stream.read(buf)) > 0) {
fileout.write(buf, 0, len);
}

fileout.close();
drawable = Drawable.createFromPath(file.toString());
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(),
drawable.getIntrinsicHeight());
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return drawable;
}
};

10. http://developer.android.com/reference/android/R.drawable.html
public class HelloTabs extends TabActivity implements TabHost.TabContentFactory {
        View v;
   
   @Override
   protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       TabHost tabHost = getTabHost();
       LayoutInflater.from(this).inflate(R.layout.main, tabHost.getTabContentView(), true);

       tabHost.addTab(tabHost.newTabSpec("tab1")
               .setIndicator("tab1", getResources().getDrawable(android.R.drawable.star_big_on))
               .setContent(R.id.view1));
       tabHost.addTab(tabHost.newTabSpec("tab2")
        .setIndicator("tab2", getResources().getDrawable(android.R.drawable.star_big_off))
               .setContent(R.id.view2));
       tabHost.addTab(tabHost.newTabSpec("tab3")
        .setIndicator("tab3", getResources().getDrawable(android.R.drawable.stat_notify_call_mute))
               .setContent(this));
   }

   @Override
public View createTabContent(String tag) {
    TextView tv = new TextView(this);
    tv.setText("Content for tab with tag " + tag);
       return tv;
   }
}

11.     private static int MOOD_NOTIFICATIONS = R.layout.main;
    private NotificationManager mNM;
    private final int[] mood = {R.drawable.stat_happy,R.drawable.stat_neutral,R.drawable.stat_sad};
    private final int[] message = {R.string.status_bar_happy_message,R.string.status_bar_ok_message, R.string.status_bar_sad_message};
          CharSequence text = getText(textId);
        Notification notification = new Notification(moodId, text, System.currentTimeMillis());
        PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
                new Intent(this, SyncThread.class), 0);

        notification.setLatestEventInfo(this, getText(R.string.status_bar_mood_title),
                       text, contentIntent);
        mNM.notify(MOOD_NOTIFICATIONS, notification);

12.
 private void addEvent(String title) {
    SQLiteDatabase db = hostData.getWritableDatabase();
    ContentValues values = new ContentValues();
    values.put(HostDatabase.TIME, System.currentTimeMillis());
    values.put(HostDatabase.TITLE, title);
    db.insert(HostDatabase.TABLE, null, values);
   }

  private void deleteEvent(String title) {
   SQLiteDatabase db = hostData.getWritableDatabase();
   db.delete(HostDatabase.TABLE, "tiltle=?", new String[] {title});
  }

  private void updateEvent(String title) {
   SQLiteDatabase db = hostData.getWritableDatabase();
   ContentValues values = new ContentValues();
   values.put(HostDatabase.TIME, System.currentTimeMillis());
   db.update(HostDatabase.TABLE, values, "tiltle=?", new String[] {title});
  }
 
  private Cursor getEvents() {
    SQLiteDatabase db = hostData.getReadableDatabase();
    Cursor cursor = db.query(HostDatabase.TABLE, null, null, null, null,
        null, null);
   
    startManagingCursor(cursor);
    return cursor;
  }

  private void showEvents(Cursor cursor) {
    StringBuilder ret = new StringBuilder("Saved Events:\n\n");
    while (cursor.moveToNext()) {
      long id = cursor.getLong(0);
      long time = cursor.getLong(1);
      String des = cursor.getString(2);
      ret.append(id + ": " + time + ": " + des + "\n");
    }
    output.setText(ret);
  }

@Override
public void onCreate(SQLiteDatabase db) {
String sql = "create table " + TABLE + "( " + BaseColumns._ID
+ " integer primary key autoincrement, " + TIME + " integer, "
+ TITLE + " text not null);";
Log.d("EventsData", "onCreate: " + sql);
db.execSQL(sql);
}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
if (oldVersion >= newVersion)
return;

String sql = null;
if (oldVersion == 1)
sql = "alter table " + TABLE + " add note text;";
if (oldVersion == 2)
sql = "";

Log.d("EventsData", "onUpgrade : " + sql);
if (sql != null)
db.execSQL(sql);
}

13.     <ProgressBar android:id="@+android:id/progress_large"
        style="?android:attr/progressBarStyleLarge"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
    <ProgressBar android:id="@+android:id/progress"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
    <ProgressBar android:id="@+android:id/progress_small"
        style="?android:attr/progressBarStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
    <ProgressBar android:id="@+android:id/progress_small_title"
        style="?android:attr/progressBarStyleSmallTitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

        // Request for the progress bar to be shown in the title
        requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
       
        setContentView(R.layout.main);
       
        // Make sure the progress bar is visible
        setProgressBarVisibility(true);
14. android:bufferType="spannable"
    http://blog.naver.com/taiji567?Redirect=Log&logNo=109529292

미러링크(터미널모드)(2012. 01. 30)

1. N-Screen
2. 미러링크(터미널 모드 : terminal mode)
3. MDS
4. http://www.mdstec.com/main/ : 02-2106-6000
5. phone to car : mds : 구성모 이사 (031)600-5011, 010-2275-8921
   - RTP, VNC, UPnP 기반 기술을 자체 개발하여 SW 공개 부담 해소
     스마트폰 검색 및 VNC 데이터
6. The Car Connectivity Consortium
7. In-car apps
8. 현대차 글로벌 텔레매틱스 브랜드인 ‘블루링크’
9. 현대차는 이번 박람회에서‘블루링크’를 비롯해 ▲스마트 커넥티비티 시스템(Smart Connectivity System), ▲근접인식 마우스틱(Motion Sensor Moustick), ▲지능형 햅틱 시스템(Intelligent Haptic System), ▲다이나믹 클러스터(Dynamic Cluster), ▲차량용 브라우저/웹 플랫폼(Car Browser System & Web Platform), ▲차량용 영상인식 안전시스템(Multifunctional Safety Vision System) 등 총 6종의 차량-IT 첨단 신기술을 선보였다.

2012년 1월 27일 금요일

[android] Thread (2012. 01. 27)

1 2138 native 3 4 main
*2 2139 vmwait 2 0 HeapWorker
*3 2140 vmwait 0 0 GC
*4 2141 vmwait 0 0 Signal Catcher
*5 2142 running 0 0 JDWP(디버깅을 위한 VM과 연결하는 쓰레드)
*6 2143 vmwait 0 0 Compiler
7 2144 native 0 0 Binder Thread #1
8 2145 native 0 0 Binder Thread #2
==> ui thread 1개, 데몬쓰레드 5개, IPC 쓰레드 2개

android.os.MessageQueue nativePollOnce MessageQueue.java -2 true
android.os.MessageQueue next MessageQueue.java 137 false
android.os.Looper loop Looper.java 117 false
android.app.ActivityThread main ActivityThread.java 3701 false
java.lang.reflect.Method invokeNative Method.java -2 true
java.lang.reflect.Method invoke Method.java 507 false
com.android.internal.os.ZygoteInit$MethodAndArgsCaller run ZygoteInit.java 895 false
com.android.internal.os.ZygoteInit main ZygoteInit.java 653 false
dalvik.system.NativeStart main NativeStart.java -2 true

public static final String CATEGORY_EMBED
Since: API Level 1
Capable of running inside a parent activity container.
Constant Value: "android.intent.category.EMBED"

[android APIDEMO] Link(2012. 01. 27)

http://dodo4989.tistory.com/405

/*
 * Copyright (C) 2007 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.example.android.apis.text;

import com.example.android.apis.R;

import android.app.Activity;
import android.graphics.Typeface;
import android.os.Bundle;
import android.text.Html;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.method.LinkMovementMethod;
import android.text.style.StyleSpan;
import android.text.style.URLSpan;
import android.widget.TextView;

public class Link extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.link);

        // text1 shows the android:autoLink property, which
        // automatically linkifies things like URLs and phone numbers
        // found in the text.  No java code is needed to make this
        // work.

        // text2 has links specified by putting <a> tags in the string
        // resource.  By default these links will appear but not
        // respond to user input.  To make them active, you need to
        // call setMovementMethod() on the TextView object.

        TextView t2 = (TextView) findViewById(R.id.text2);
        t2.setMovementMethod(LinkMovementMethod.getInstance());

        // text3 shows creating text with links from HTML in the Java
        // code, rather than from a string resource.  Note that for a
        // fixed string, using a (localizable) resource as shown above
        // is usually a better way to go; this example is intended to
        // illustrate how you might display text that came from a
        // dynamic source (eg, the network).

        TextView t3 = (TextView) findViewById(R.id.text3);
        t3.setText(
            Html.fromHtml(
                "<b>text3:</b>  Text with a " +
                "<a href=\"http://www.google.com\">link</a> " +
                "created in the Java source code using HTML."));
        t3.setMovementMethod(LinkMovementMethod.getInstance());

        // text4 illustrates constructing a styled string containing a
        // link without using HTML at all.  Again, for a fixed string
        // you should probably be using a string resource, not a
        // hardcoded value.

        SpannableString ss = new SpannableString(
            "text4: Click here to dial the phone.");

        ss.setSpan(new StyleSpan(Typeface.BOLD), 0, 6,
                   Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        ss.setSpan(new URLSpan("tel:4155551212"), 13, 17,
                   Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

        TextView t4 = (TextView) findViewById(R.id.text4);
        t4.setText(ss);
        t4.setMovementMethod(LinkMovementMethod.getInstance());
    }
}

[android APIDEMO] SurfaceViewOverlay(2012. 01. 27)

/*
 * Copyright (C) 2007 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.example.android.apis.graphics;

import android.app.Activity;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

//Need the following import to get access to the app resources, since this
//class is in a sub-package.
import com.example.android.apis.R;

/**
 * Demonstration of overlays placed on top of a SurfaceView.
 */
public class SurfaceViewOverlay extends Activity {
    View mVictimContainer;
    View mVictim1;
    View mVictim2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.surface_view_overlay);

        GLSurfaceView glSurfaceView =
            (GLSurfaceView) findViewById(R.id.glsurfaceview);
        glSurfaceView.setRenderer(new CubeRenderer(false));

        // Find the views whose visibility will change
        mVictimContainer = findViewById(R.id.hidecontainer);
        mVictim1 = findViewById(R.id.hideme1);
        mVictim1.setOnClickListener(new HideMeListener(mVictim1));
        mVictim2 = findViewById(R.id.hideme2);
        mVictim2.setOnClickListener(new HideMeListener(mVictim2));

        // Find our buttons
        Button visibleButton = (Button) findViewById(R.id.vis);
        Button invisibleButton = (Button) findViewById(R.id.invis);
        Button goneButton = (Button) findViewById(R.id.gone);

        // Wire each button to a click listener
        visibleButton.setOnClickListener(mVisibleListener);
        invisibleButton.setOnClickListener(mInvisibleListener);
        goneButton.setOnClickListener(mGoneListener);
    }

    @Override
    protected void onResume() {
        // Ideally a game should implement onResume() and onPause()
        // to take appropriate action when the activity looses focus
        super.onResume();
    }

    @Override
    protected void onPause() {
        // Ideally a game should implement onResume() and onPause()
        // to take appropriate action when the activity looses focus
        super.onPause();
    }

    class HideMeListener implements OnClickListener {
        final View mTarget;

        HideMeListener(View target) {
            mTarget = target;
        }

        public void onClick(View v) {
            mTarget.setVisibility(View.INVISIBLE);
        }

    }

    OnClickListener mVisibleListener = new OnClickListener() {
        public void onClick(View v) {
            mVictim1.setVisibility(View.VISIBLE);
            mVictim2.setVisibility(View.VISIBLE);
            mVictimContainer.setVisibility(View.VISIBLE);
        }
    };

    OnClickListener mInvisibleListener = new OnClickListener() {
        public void onClick(View v) {
            mVictim1.setVisibility(View.INVISIBLE);
            mVictim2.setVisibility(View.INVISIBLE);
            mVictimContainer.setVisibility(View.INVISIBLE);
        }
    };

    OnClickListener mGoneListener = new OnClickListener() {
        public void onClick(View v) {
            mVictim1.setVisibility(View.GONE);
            mVictim2.setVisibility(View.GONE);
            mVictimContainer.setVisibility(View.GONE);
        }
    };
}

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2007 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at
 
          http://www.apache.org/licenses/LICENSE-2.0
 
     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<!-- Demonstrates changing view visibility. See corresponding Java code. -->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    <!-- Here is where we put the SurfaceView, in a frame so that we can
         stack other views on top of it. -->
    <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="0px"
            android:layout_weight="1">

        <android.opengl.GLSurfaceView android:id="@+id/glsurfaceview"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

        <LinearLayout android:id="@+id/hidecontainer"
                android:orientation="vertical"
                android:visibility="gone"
                android:background="@drawable/translucent_background"
                android:gravity="center"
                android:layout_width="match_parent"
                android:layout_height="match_parent">

            <Button android:id="@+id/hideme1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:visibility="gone"
                    android:text="@string/hide_me"/>
           
            <Button android:id="@+id/hideme2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:visibility="gone"
                    android:text="@string/hide_me"/>
                   
        </LinearLayout>
       
    </FrameLayout>
           
    <LinearLayout
            android:orientation="horizontal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center">

        <Button android:id="@+id/vis"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/visibility_1_vis"/>

        <Button android:id="@+id/invis"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/visibility_1_invis"/>

        <Button android:id="@+id/gone"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/visibility_1_gone"/>

    </LinearLayout>

</LinearLayout>

/*
 * Copyright (C) 2007 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.example.android.apis.graphics;

import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

import android.opengl.GLSurfaceView;

/**
 * Render a pair of tumbling cubes.
 */

public class CubeRenderer implements GLSurfaceView.Renderer {
    public CubeRenderer(boolean useTranslucentBackground) {
        mTranslucentBackground = useTranslucentBackground;
        mCube = new Cube();
    }

    public void onDrawFrame(GL10 gl) {
        /*
         * Usually, the first thing one might want to do is to clear
         * the screen. The most efficient way of doing this is to use
         * glClear().
         */

        gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);

        /*
         * Now we're ready to draw some 3D objects
         */

        gl.glMatrixMode(GL10.GL_MODELVIEW);
        gl.glLoadIdentity();
        gl.glTranslatef(0, 0, -3.0f);
        gl.glRotatef(mAngle,        0, 1, 0);
        gl.glRotatef(mAngle*0.25f,  1, 0, 0);

        gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
        gl.glEnableClientState(GL10.GL_COLOR_ARRAY);

        mCube.draw(gl);

        gl.glRotatef(mAngle*2.0f, 0, 1, 1);
        gl.glTranslatef(0.5f, 0.5f, 0.5f);

        mCube.draw(gl);

        mAngle += 1.2f;
    }

    public void onSurfaceChanged(GL10 gl, int width, int height) {
         gl.glViewport(0, 0, width, height);

         /*
          * Set our projection matrix. This doesn't have to be done
          * each time we draw, but usually a new projection needs to
          * be set when the viewport is resized.
          */

         float ratio = (float) width / height;
         gl.glMatrixMode(GL10.GL_PROJECTION);
         gl.glLoadIdentity();
         gl.glFrustumf(-ratio, ratio, -1, 1, 1, 10);
    }

    public void onSurfaceCreated(GL10 gl, EGLConfig config) {
        /*
         * By default, OpenGL enables features that improve quality
         * but reduce performance. One might want to tweak that
         * especially on software renderer.
         */
        gl.glDisable(GL10.GL_DITHER);

        /*
         * Some one-time OpenGL initialization can be made here
         * probably based on features of this particular context
         */
         gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT,
                 GL10.GL_FASTEST);

         if (mTranslucentBackground) {
             gl.glClearColor(0,0,0,0);
         } else {
             gl.glClearColor(1,1,1,1);
         }
         gl.glEnable(GL10.GL_CULL_FACE);
         gl.glShadeModel(GL10.GL_SMOOTH);
         gl.glEnable(GL10.GL_DEPTH_TEST);
    }
    private boolean mTranslucentBackground;
    private Cube mCube;
    private float mAngle;
}

[android APIDEMO] AlphaBitmap (2012. 01. 27)

http://stackoverflow.com/questions/3580051/how-to-prevent-androids-drawbitmap-from-only-drawing-black-images
           Paint.FontMetrics fm = p.getFontMetrics();
           c.drawText("Alpha", x/2, (y-fm.ascent)/2, p);

BlurMaskFilter blurFilter = new BlurMaskFilter(2, BlurMaskFilter.Blur.OUTER);
           Paint shadowPaint = new Paint();
           shadowPaint.setMaskFilter(blurFilter);

           int[] offsetXY = new int[2];
           
           mBitmap2 = mBitmap.extractAlpha(shadowPaint,offsetXY);
           //Canvas c = new Canvas(shadowImage);
           //c.drawBitmap(originalBitmap, -offsetXY[0], -offsetXY[1], null);


/*
 * Copyright (C) 2007 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.example.android.apis.graphics;

import com.example.android.apis.R;

import android.app.Activity;
import android.content.Context;
import android.graphics.*;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.*;

import java.io.InputStream;
import java.io.ByteArrayOutputStream;

public class AlphaBitmap extends GraphicsActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(new SampleView(this));
    }
   
    private static class SampleView extends View {
        private Bitmap mBitmap;
        private Bitmap mBitmap2;
        private Bitmap mBitmap3;
        private Shader mShader;
       
        private static void drawIntoBitmap(Bitmap bm) {
            float x = bm.getWidth();
            float y = bm.getHeight();
            Canvas c = new Canvas(bm);
            Paint p = new Paint();
            p.setAntiAlias(true);
           
            p.setAlpha(0x80);
            c.drawCircle(x/2, y/2, x/2, p);
           
            p.setAlpha(0x30);
            p.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC));
            p.setTextSize(60);
            p.setTextAlign(Paint.Align.CENTER);
            Paint.FontMetrics fm = p.getFontMetrics();
            c.drawText("Alpha", x/2, (y-fm.ascent)/2, p);
        }
       
        public SampleView(Context context) {
            super(context);
            setFocusable(true);
           
            InputStream is = context.getResources().openRawResource(R.drawable.app_sample_code);
            mBitmap = BitmapFactory.decodeStream(is);
            mBitmap2 = mBitmap.extractAlpha();
            mBitmap3 = Bitmap.createBitmap(200, 200, Bitmap.Config.ALPHA_8);
            drawIntoBitmap(mBitmap3);
           
            mShader = new LinearGradient(0, 0, 100, 70, new int[] {
                                         Color.RED, Color.GREEN, Color.BLUE },
                                         null, Shader.TileMode.MIRROR);
        }
       
        @Override protected void onDraw(Canvas canvas) {
            canvas.drawColor(Color.WHITE);

            Paint p = new Paint();
            float y = 10;
           
            p.setColor(Color.RED);
            canvas.drawBitmap(mBitmap, 10, y, p);
            y += mBitmap.getHeight() + 10;
            canvas.drawBitmap(mBitmap2, 10, y, p);
            y += mBitmap2.getHeight() + 10;
            p.setShader(mShader);
            canvas.drawBitmap(mBitmap3, 10, y, p);
        }
    }
}

[android APIDEMO] Typefaces(2012. 01. 27)

/*
 * Copyright (C) 2008 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.example.android.apis.graphics;

import android.app.Activity;
import android.content.Context;
import android.graphics.*;
import android.os.Bundle;
import android.view.View;

public class Typefaces extends GraphicsActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(new SampleView(this));
    }
   
    private static class SampleView extends View {
        private Paint    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        private Typeface mFace;
       
        public SampleView(Context context) {
            super(context);

            mFace = Typeface.createFromAsset(getContext().getAssets(),
                                             "fonts/samplefont.ttf");
           
            mPaint.setTextSize(64);
        }
       
        @Override protected void onDraw(Canvas canvas) {
            canvas.drawColor(Color.WHITE);

            mPaint.setTypeface(null);
            canvas.drawText("Default", 10, 100, mPaint);
            mPaint.setTypeface(mFace);
            canvas.drawText("Custom", 10, 200, mPaint);
        }
    }
}

[android APIDEMO] Compass (2012. 01. 27)

   //삼각형
           mPath.moveTo(0, -20);
           mPath.lineTo(0, 20);
           mPath.lineTo(20, 0);
           mPath.close();
/*
 * Copyright (C) 2007 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.example.android.apis.graphics;

import android.app.Activity;
import android.content.Context;
import android.graphics.*;
import android.hardware.SensorListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import android.util.Config;
import android.util.Log;
import android.view.View;

public class Compass extends GraphicsActivity {

    private static final String TAG = "Compass";

private SensorManager mSensorManager;
    private SampleView mView;
    private float[] mValues;
   
    private final SensorListener mListener = new SensorListener() {
   
        public void onSensorChanged(int sensor, float[] values) {
            if (Config.LOGD) Log.d(TAG, "sensorChanged (" + values[0] + ", " + values[1] + ", " + values[2] + ")");
            mValues = values;
            if (mView != null) {
                mView.invalidate();
            }
        }

        public void onAccuracyChanged(int sensor, int accuracy) {
            // TODO Auto-generated method stub
           
        }
    };

    @Override
    protected void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        mSensorManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE);
        mView = new SampleView(this);
        setContentView(mView);
    }

    @Override
    protected void onResume()
    {
        if (Config.LOGD) Log.d(TAG, "onResume");
        super.onResume();
        mSensorManager.registerListener(mListener,
        SensorManager.SENSOR_ORIENTATION,
        SensorManager.SENSOR_DELAY_GAME);
    }
   
    @Override
    protected void onStop()
    {
        if (Config.LOGD) Log.d(TAG, "onStop");
        mSensorManager.unregisterListener(mListener);
        super.onStop();
    }

    private class SampleView extends View {
        private Paint   mPaint = new Paint();
        private Path    mPath = new Path();
        private boolean mAnimate;
        private long    mNextTime;

        public SampleView(Context context) {
            super(context);

            // Construct a wedge-shaped path
            mPath.moveTo(0, -50);
            mPath.lineTo(-20, 60);
            mPath.lineTo(0, 50);
            mPath.lineTo(20, 60);
            mPath.close();
        }
   
        @Override protected void onDraw(Canvas canvas) {
            Paint paint = mPaint;

            canvas.drawColor(Color.WHITE);
           
            paint.setAntiAlias(true);
            paint.setColor(Color.BLACK);
            paint.setStyle(Paint.Style.FILL);

            int w = canvas.getWidth();
            int h = canvas.getHeight();
            int cx = w / 2;
            int cy = h / 2;

            canvas.translate(cx, cy);
            if (mValues != null) {          
                canvas.rotate(-mValues[0]);
            }
            canvas.drawPath(mPath, mPaint);
        }
   
        @Override
        protected void onAttachedToWindow() {
            mAnimate = true;
            super.onAttachedToWindow();
        }
       
        @Override
        protected void onDetachedFromWindow() {
            mAnimate = false;
            super.onDetachedFromWindow();
        }
    }
}

2012년 1월 18일 수요일

이슈 URL(GWT, codepro, android fullsource, ar(퀄컴) 2012. 01. 18

GWT 지원 도구
http://code.google.com/intl/ko-KR/javadevtools/codepro/doc/features/metrics/metrics_details.html
http://huewu.blog.me/110118172113
android fullsorce
http://www.kandroid.org/board/board.php?board=androidsource&command=body&no=81
ar
http://ontheworld.tistory.com/entry/%EC%95%88%EB%93%9C%EB%A1%9C%EC%9D%B4%EB%93%9C-%ED%8F%B0%EC%97%90%EC%84%9C-%EB%8F%8C%EB%A0%A4%EB%B3%B8-Qualcomm-AR-SDK

2012년 1월 12일 목요일

[android-ndk]android-ndk-r7에서는 cygwin없이 cmd 파일 제공함 2012. 01. 13

과거 : D:\work\android\app\NDK\android-ndk-r4b;D:\work\android\app\NDK\android-ndk-r6\build\prebuilt\windows\arm-eabi-4.2.1\bin;
현재 : D:\work\android\app\NDK\android-ndk-r7;
http://millo.tistory.com/2
D:\work\android\app\NDK\android-ndk-r7\prebuilt\windows\bin\awk.exe => _awk.exe로 (삭제의미)

APP_ABI := all
APP_ABI := armeabi armeabi-v7a x86


Drifter  
프로필 보기   한국어로 번역
 추가 옵션 2010년12월21일, 오전8시50분
I tried this, and although it built successfully, the dependencies
didn't work correctly (I could change a header and it wouldn't
recompile the appropriate files).
So instead I tried editing build/core/definitions.mk and changed the
line
    $(HOST_AWK) -f $(BUILD_AWK)/convert-deps-to-cygwin.awk $1.org > $1
&& \
to
    sed -e "s/\(.\):\//\/cygdrive\/\L\1\//g" $1.org > $1 && \
which converts all the instances of C:\ to /cygdrive/c/ (along with
all the other drive letters).

http://groups.google.com/group/android-ndk/browse_thread/thread/83ef26ef301c87b7/b736b6595f01df74

http://www.rosoo.net/a/201108/14840.html
Error 1:
$ ndk-build
/cygdrive/c/andy/abc/obj/local/armeabi-v7a/objs/abc//hellow.o.d:1: *** multiple target patterns. Stop.

quick fix: Delete Obj folder from "C:\andy\prjM\obj\local\armeabi-v7a" then run ndk-build
or refer this

Error 2:
Android.mk:44: *** commands commence before first target. Stop.
fix: Check there are no comments,no space ,no empty line in the src includes of Android.mk

For example:
wrong:
LOCAL_SRC_FILES :=file1.cpp\
file1al.cpp\
#file1atures.cpp\
file1r.cpp\

file1le.cpp\
Satfile1.cpp\
Sfile1l.cpp\
file1e.cpp\
Sfile1face.cpp\

3rd line has #, 4th line has space(check with cursor),5th line is empty line

Right:
LOCAL_SRC_FILES :=file1.cpp\
file1al.cpp\
file1atures.cp\
file1r.cpp\
file1le.cpp\
Satfile1.cpp\
Sfile1l.cpp\
file1e.cpp\
Sfile1face.cpp\

Error 3:
$ ndk-build clean
Android NDK: Could not find application project directory !
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.
/cygdrive/c/android-ndk-r4b/build/core/build-local.mk:85: *** Android NDK: Aborting . Stop.

Fix: include Android.mk location inside global application.mk and Android.mk
Run the command from the parent directory with app.mk and and.mk resides

Error 4:

Please define ANDROID_NDK_ROOT to point to the root of your
Android NDK installation.

Use case while executing shell script

xxx-desktop:~/bin/u/android-ndk-r5/build/tools$ ./rebuild-all-prebuilt.sh
Please define ANDROID_NDK_ROOT to point to the root of your
Android NDK installation.

// Run the script inside NDK root directory like shown below
xxx-desktop:~/bin/u/android-ndk-r5/build/tools$ cd ..
xxx-desktop:~/bin/u/android-ndk-r5/build$ cd ..
xxxx-desktop:~/bin/u/android-ndk-r5$ ./build/tools/rebuild-all-prebuilt.sh

Error 5: NDK r5 app(native-activity,native-audio,native-plasma) build problem

Compiling native-activity,native-audio,native-plasma on ndk-r5 give compile errors stating

header not found and  so on ......

Quick fix:  Rebuild all prebuilt

i;e execute shell script rebuild-all-prebuilt.sh to build on latest toolchain provided by android which will take for a while (atleast on my pc)

xxx-desktop:~/bin/u/android-ndk-r5$ ./build/tools/rebuild-all-prebuilt.sh
To follow build in another terminal, please use: tail -F /tmp/ndk-toolchain/build-CtAG7s/log.txt
Download sources from android.git.kernel.org
Using git clone prefix: git://android.git.kernel.org/toolchain
downloading sources for toolchain/binutils
downloading sources for toolchain/build
downloading sources for toolchain/gcc
downloading sources for toolchain/gdb
downloading sources for toolchain/gmp
downloading sources for toolchain/gold
downloading sources for toolchain/mpfr
Patching toolchain sources
Toolchain sources downloaded and copied to /tmp/ndk-toolchain/build-CtAG7s/src
Cleaning up...발행하기
Done.
Building arm-eabi-4.4.0 toolchain... (this can be long)
ERROR: Could bot build arm-eabi-4.4.0 toolchain!
xxxx-desktop:~/bin/u/android-ndk-r5$

Now change to native-activity folder and call ndk-build for successful libnative-activity.so

xxx-desktop:~/bin/u/android-ndk-r5/samples/native-activity$ ndk-build
Compile thumb  : native-activity <= main.c
Compile thumb  : android_native_app_glue <= android_native_app_glue.c
StaticLibrary  : libandroid_native_app_glue.a
SharedLibrary  : libnative-activity.so
Install        : libnative-activity.so => libs/armeabi/libnative-activity.so

2012년 1월 10일 화요일

Android 참고할 소스 Keyword(2012. 01. 10)

** 1 **
http://lwn.net/
http://www.kandroid.org/board/board.php?board=androidsource&command=body&no=82

** 2 **

CompoundButton
ProgressDialog
progressDialog.setView(view)
ProgressBar

file.canRead()

        addPreferencesFromResource(R.xml.preferences);
        togglePreference = (TogglePreference) getPreferenceManager().findPreference(ApplicationConstants.SETTINGS_TOGGLE_BUTTON);


Log.isLoggable(TAG, Log.VERBOSE)

ConnManagerParams.setTimeout(params, REGISTRATION_TIMEOUT);

DateUtils.SECOND_IN_MILLIS

** 3 **


MainActivity.java
        // Init Application
        this.application = (TetherApplication)this.getApplication();
        MainActivity.setCurrent(this);
TetherApplication.java
        // Whitelist
        this.whitelist = this.coretask.new Whitelist();
class DnsUpdate implements Runnable {

    String[] dns;
   
    public DnsUpdate(String[] dns) {
    this.dns = dns;
    }
   
public void run() {
           while (!Thread.currentThread().isInterrupted()) {
            String[] currentDns = TetherApplication.this.coretask.getCurrentDns();
            if (this.dns == null || this.dns[0].equals(currentDns[0]) == false || this.dns[1].equals(currentDns[1]) == false) {
            this.dns = TetherApplication.this.coretask.updateResolvConf();
            }
               // Taking a nap
      try {
    Thread.sleep(10000);
    } catch (InterruptedException e) {
    Thread.currentThread().interrupt();
    }
           }
}
   }  


   <uses-permission
        android:name="android.permission.WRITE_SETTINGS" />
    <uses-permission
        android:name="android.permission.WRITE_SECURE_SETTINGS" />
    <uses-permission
        android:name="android.permission.READ_CONTACTS" />
    <uses-permission
        android:name="android.permission.WRITE_CONTACTS" />
    <uses-permission
        android:name="android.permission.READ_SYNC_STATS" />
    <uses-permission
        android:name="android.permission.READ_SYNC_SETTINGS" />
    <uses-permission
        android:name="android.permission.WRITE_SYNC_SETTINGS" />


 public static Thread performOnBackgroundThread(final Runnable runnable) {
        final Thread t = new Thread() {
            @Override
            public void run() {
                try {
                    runnable.run();
                } finally {

                }
            }
        };
        t.start();
        return t;
    }

    @Override
    public final void onHandleIntent(Intent intent) {
        try {
            Context context = getApplicationContext();
            if (intent.getAction().equals(REGISTRATION_CALLBACK_INTENT)) {
                handleRegistration(context, intent);
            } else if (intent.getAction().equals(C2DM_INTENT)) {
                onMessage(context, intent);
            } else if (intent.getAction().equals(C2DM_RETRY)) {
                C2DMessaging.register(context, senderId);
            }
        } finally {
            //  Release the power lock, so phone can get back to sleep.
            // The lock is reference counted by default, so multiple
            // messages are ok.
           
            // If the onMessage() needs to spawn a thread or do something else,
            // it should use it's own lock.
            mWakeLock.release();
        }
    }

2012년 1월 3일 화요일

휴넷 javascript 온라인강의(2012년 01월 03일)

 * 2012년 01월 27일  : 8일차 강의 * 

<HTML>
       <HEAD>
       <TITLE> 예제1 </TITLE>
       <SCRIPT LANGUAGE="Javascript">
       <!--
  function wave_window() {
  if(self.moveBy) {
       for(i=5;i>0;i--) {
          for(j=10;j>0;j--) {
             top.moveBy(-i,0)
             top.moveBy(i,0)
             top.moveBy(0,-i)
             top.moveBy(0,i)
                     }
                }
           }
    }

       //-->
       </SCRIPT>
       </HEAD>
       <BODY>
         <h4>아래의 버튼을 클릭해 보세요.</h4>
    <input type="button" value="click here!" onClick="wave_window()">

       </BODY>
  </HTML>

 <HTML>
       <HEAD>
       <TITLE> 예제2 </TITLE>
       </HEAD>
       <BODY>
       <h4>즐겨찾기에 추가히기</h4>
       * 아래의 버튼을 클릭하면 즐겨찾기에 추가됩니다. <p>
       <form>
    <input type="button" name="btn" value="삼성에듀닷컴"
    onClick="javascript:window.external.AddFavorite
    ('http://www.samsungedu.com', '삼성에듀닷컴')">

       </form>
       </BODY>
  </HTML>

<HTML>
       <HEAD>
       <TITLE> 예제3 </TITLE>
       <SCRIPT LANGUAGE="Javascript">
       <!--
  function image_size() {
  if(miffy_img.style.pixelWidth < 344)
  {
  miffy_img.style.pixelWidth += 8
  miffy_img.style.pixelHeight += 7
  window.setTimeout("image_size()", 5)
      }
  }

        //-->
       </SCRIPT>
       </HEAD>
  <BODY onLoad="image_size()">

       <br><br><br>
       <center>
       <h2>Welcome to My Homepage</h2>
  <img src="img_05.jpg" id="miffy_img" style="width: 0px; height: 0px">

       </center>
       </BODY>
  </HTML>

<HTML>
       <HEAD>
       <TITLE> 예제4 </TITLE>
       <SCRIPT LANGUAGE="Javascript">
       <!--
function born_year () {
var d_year = 1972
var new_year = document.year_form.inyear.value
i = (d_year -new_year) _ 12
if (i == 0) {birth_year="쥐띠"}
else {
if ((i == 1) || (i == -11)){birth_year="돼지띠"}
else {
if ((i == 2) || (i == -10)){birth_year="개띠"}
else {
if ((i == 3) || (i == -9)){birth_year="닭띠"}
else {
if ((i == 4) || (i == -8)){birth_year="원숭이띠"}
else {
if ((i == 5) || (i == -7)){birth_year="양띠"}
else {
if ((i == 6) || (i == -6)){birth_year="말띠"}
else {
if ((i == 7) || (i == -5)){birth_year="뱀띠"}
else {
if ((i == 8) || (i == -4)){birth_year="용띠"}
else {
if ((i == 9) || (i == -3)){birth_year="토끼띠"}
else {
if ((i == 10) || (i == -2)){birth_year="호랑이띠"}
else {
if ((i == 11) || (i == -1)){birth_year="소띠"}
}}}}}}}}}}}
document.year_form.birth.value = birth_year;
}

       //-->
       </SCRIPT>
       </HEAD>
       <BODY>
       <center>
       <h3> ◐ 띠 알아보기 ◑ </h3>
<form NAME="year_form">
띠를 알고싶은 년도를 입력한 후 [띠보기]버튼을 클릭하세요<p>
<input TYPE="text" SIZE="4" NAME="inyear" value="2003">
<input TYPE="button" VALUE="띠보기" onClick="born_year()"><p>
입력하신 해당 년도의 띠는 <input TYPE="text" SIZE="9" NAME="birth">입니다
</form>
       </center>
       </BODY>
  </HTML>

<HTML>
       <HEAD>
       <TITLE> 예제5 </TITLE>
       <SCRIPT LANGUAGE="Javascript">
       <!--
   Start = new Date()
   function load_time() {
   Stop = new Date()
   i = Stop.getTime() - Start.getTime()
   result_time = i / 1000
   alert("이 페이지를 로딩하는데 걸린 시간은 \n\n" + result_time + " 초 입니다.")
   }
       //-->
       </SCRIPT>
       </HEAD>
       <BODY>
    <BODY onLoad="load_time()">

       <center>
       <h3>Welcome to Myhomepage</h3>
       <img src="miffy_05.gif" border="0">
       </center>
       </BODY>
  </HTML>


 * 2012년 01월 26일  : 7일차 강의 * 

   
  Document객체의 속성은 다음과 같습니다.


속성   의 미
 
title   문서의 제목을 표시합니다.
 
location   문서가 있는 위치를 표시합니다.
 
lastModified   문서를 마지막으로 수정한 날짜와 시간을 표시합니다.
 
referrer   링크한 원래 문서의 url 주소를 표시합니다.
 
bgColor   문서의 배경색상을 지정합니다.
 
fgColor   글자 색상을 지정합니다.
 
linkColor   하이퍼 링크가 성정된 글자 색상을 지정합니다.
 
alinkColor   하이퍼 링크 글자를 누르고 있는 상태의 색상을 지정합니다.
 
vlinkColor   하이퍼 링크를 선택하고 난 후의 글자 색상을 지정합니다.

document.lastModified

 Document객체에 사용되는 메소드는 문서에 내용을 표시하거나 지우는 등의 효과에 적용이 되는데요.
지금까지 계속 사용해왔던 write()도 Document객체의 메소드 중 하나입니다.
속성   의 미
 
open()   문서에 자료를 출력하기 위한 준비를 합니다.
 
close()   문서에 자료 출력하는 것을 종료시킵니다.
 
clear()   문서를 지웁니다.
 
write()   문서에 자료를 출력합니다.
 
writeln()   문서에 자료를 출력하고 줄을 바꿉니다.

links 속성 입력 위치는요... ==><a  > <area >
links 속성을 사용해서 링크 정보를 표시할 경우에는 문서 하단에 내용을 입력해 주어야 합니다. 문서를 모두
읽은 후에 links 속성이 링크 개수를 판별할 수 있기 때문입니다. 따라서 만약 links 속성 내용이 본문 내용
보다 앞에 위치하면 결과가 나타나지 않는 것입니다.

link객체의 속성은 다음과 같습니다.
   
  속성  설명    
hash  표식 이름을 알려 줍니다.
host  링크에 설정되어 있는 URL 정보, 호스트 이름, 포트번호를
알려 줍니다.
hostname  링크에 설정되어 있는 URL과 호스트 이름을 알려 줍니다.
href  링크에 설정되어 있는 URL 정보를 알려 줍니다.
pathname  링크에 설정되어 있는 경로를 알려 줍니다.
port  포트 번호를 알려 줍니다.
protocol  프로토콜 종류를 알려 줍니다.
search  검색 엔진을 불러낼 때 사용합니다.
target  링크가 실행할 문서를 보여 줄 방식을 설정합니다.


 image객체의 속성은 다음과 같습니다.   ==> <IMG>
document.images[0].width
   
  속성  설명
   
name  그림 객체의 이름을 알려 줍니다.
src  그림의 경로를 알려 줍니다.
lowsrc  저해상도 그림의 경로를 알려 줍니다.
border  그림의 테두리 두께를 알려 줍니다.
height  그림의 높이를 알려 줍니다.
width  그림의 너비를 알려 줍니다.
hspace  그림의 가로 여백을 알려 줍니다.
vspace  그림의 세로 여백을 알려 줍니다.
complete  그림의 전송 완료 상태를 true와 false값으로 알려 줍니다.

 Location객체의 속성은 다음과 같습니다.
   
  속성  설명
   
href  문서의 url 주소 전체를 알려 줍니다.
host  문서의 url 주소 중 host 이름과 포트 번호를 알려 줍니다.
hostname  문서의 url 주소 중 host 이름을 알려 줍니다.
protocol  프로토콜의 종류를 알려 줍니다.
pathname  호스트에서 문서가 있는 경로를 알려 줍니다.
port  문서의 포트 번호를 알려 줍니다.
hash  문서의 표식 이름을 알려 줍니다.

location.href("www.naver.com") // 그 주소로 이동
Location 객체의 메소드

 replace(): 문서를 다른 홈페이지 주소로 대신 불러옵니다.
 reload(): 문서를 다시 읽어옵니다.

reload(), replace()

go(), forward(), back()

Frame 객체란 Window 객체의 하위객체로 2개 이상의 문서가 조합되어 만들어진 프레임을 제어하기 위한
객체입니다.

 Frame 객체의 속성

 속성  설 명
   
self  자기 자신의 프레임을 의미합니다.
   
parent  상위 계층의 프레임을 의미합니다.
   
top  최상위 계층의 프레임을 의미합니다.
   
frame[n]  배열 형식의 프레임에서 프레임의 번호를 설정합니다.

 Form객체의 속성은 다음과 같습니다.
 
  속성  설명
   
action  <form>태그의 action 속성 정보를 가져옵니다.
elements  입력 양식을 배열로 정의합니다.
encoding  <form>태그의 enctype속성 정보를 가져옵니다.
length  입력 양식의 개수를 알려줍니다.
name  <form>태그의 name속성 정보를 가져옵니다.
method  <form>태그의 method속성 정보를 가져옵니다.
target  <form>태그의 target속성 정보를 가져옵니다.
 
   
  Form객체의 메소드는 다음과 같습니다.
   
  메소드  설명
   
blur()  커서를 사라지게 합니다.
reset()  입력양식에 입력된 내용을 초기화 합니다.
submit()  입력양식에 입력한 내용을 지정된 서버로 제출합니다.
document.폼이름.action
document.폼이름.encoding
document.폼이름.name
document.폼이름.method
document.폼이름.target

자바스크립트의 위치...
폼 정보를 얻어 오는 자바스크립트를 사용할 때는 폼 양식의 정보를 먼저 읽은 후 자바스크립트가 실행되기
때문에 폼 양식 다음 줄에 위치해야 합니다. 만약 자바스크립트의 위치를 임의대로 조절하고자 한다면 먼저
자바스크립트 내용을 함수로 정의한 다음 폼 양식에 이벤트 핸들러를 사용하여 함수를 실행하게 할 수도
있습니다.
<HTML>
     <HEAD>
     <TITLE> Form객체 </TITLE>
     </HEAD>
     <BODY>
     <h4> [문서내의 폼 정보] </h4>
     <form name="table" action="http://sample.cgi"
                        method=get>
     </form>
     <SCRIPT LANGUAGE="Javascript">
     <!--
 document.write("1. 폼실행주소 :",        document.table.action,"<p>")
 document.write("2. 폼이름   :",        document.table.name,"<p>")
 document.write("3. 폼방식 :",        document.table.method)

     //-->
     </SCRIPT>
     </BODY>
</HTML>

 elements속성은 <form>태그에 글상자, 버튼, 체크 상자등 같은 입력 양식이 여러 개 삽입 되었을  
  경우에 특정한 입력 양식을 배열번호를 사용해서 선택하게 해 주는 속성입니다.
   
  document.폼이름.elements[배열번호]


 
 
  {배열번호는 다른 배열번호와 마찬가지로 0부터 입력해 주면 됩니다.)
   
  만약, 해당 배열번호의 속성을 알아내고자 한다면 다음과 같이 입력해 주면 됩니다.
 
  document.폼이름.elements[배열번호].속성


 [예제2]

<HTML>
     <HEAD>
     <TITLE> elements속성 </TITLE>
     </HEAD>
     <BODY>
     <form name="sample" >
     <input type="button" name="form_01"                value="click"><p>
      <input type="checkbox" name="form_02"
            value="bus">bus<p>
     <input type="text" name="form_03"
             value="hello"><p>
     <input type="password" name="form_04"
              value="1234" size="8" maxlength="8">
     </form>
     <SCRIPT LANGUAGE="Javascript">
     <!--
document.write("elements[0] :",    document.sample.elements[0].type,"<p>")
document.write("elements[1] :",    document.sample.elements[1].type,"<p>")
document.write("elements[2] :",    document.sample.elements[2].type,"<p>")
document.write("elements[3] :",    document.sample.elements[3].type)

     //-->
     </SCRIPT>
     </BODY>
</HTML>

 document.폼이름.reset()
document.폼이름.submit()

<HTML>
     <HEAD>
     <TITLE> reset()과 submit()메소드 </TITLE>
     <SCRIPT LANGUAGE="Javascript">
     <!--
function sub_btn()
{
document.ex.submit()
alert("전송했습니다.")
}
function res_btn()
{
document.ex.reset()
alert("초기화되었습니다.")
}
     //-->
     </SCRIPT>
     </HEAD>
     <BODY>
     <h4> [로그인 화면] </h4>
     회원ID : <input type=text><p>
     비밀번호 : <input type=password>
     <form name="ex">
     <input type="button" value="제출하기"
                  onclick="sub_btn()">
     <input type="button" value="다시입력"
                  onclick="res_btn()">
     </form>
     </BODY>
</HTML>
Document 객체의 하위객체로 <form>태그의 전반적인 정보를 가져오는데 사용됩니다.


 Form 객체의 형식

 document.폼이름.속성


 Form 객체의 속성

 속 성  설 명
 
action  <form>태그의 action 속성 정보를 가져옵니다.
 
elements  입력 양식을 배열로 정의합니다.
 
encoding  <form>태그의 enctype속성 정보를 가져옵니다.
 
length  입력 양식의 개수를 알려 줍니다.
 
name  <form>태그의 name 속성 정보를 가져옵니다.
 
method  <form>태그의 method 속성 정보를 가져옵니다.
 
target  <form>태그의 target 속성 정보를 가져옵니다.


 
  Form 객체의 메소드

 메소드  설 명
 
blur()  커서를 사라지게 합니다.
 
reset()  입력 양식에 입력된 내용을 초기화 합니다.
 
submit()  입력 양식에 입력한 내용을 지정된 서버로 제출합니다.
 elements 속성

 <form>태그에 글상자, 버튼, 체크 상자등 같은 입력 양식이 여러 개 삽입되었을 경우에 특정한 입력
 양식을 배열번호로 사용해서 선택하게 해 주는 속성입니다.

 document.폼이름.elements[배열번호]
 
 만약, 해당 배열번호의 속성을 알아내고자 한다면 다음과 같이 입력합니다.
 document.폼이름.elements[배열번호].속성


 reset()과 submit()메소드

 reset()메소드는 입력 양식을 추기화로 만들어 주고, submit()메소드는 사용자가 폼 형식에
 입력한 내용을 전송하게 해줍니다.

 document.폼이름.reset()
document.폼이름.submit()


 * 2012년 01월 25일  : 6일차 강의 *
Array 객체의 메소드는 다음과 같습니다.

메소드  기능
  
concat()  여러 배열을 하나로 합하여 새로운 배열로 만들어 줍니다. 
  
join()  배열 값을 하나의 문자열로 바꿔 줍니다.
  
reverse()  배열 값의 위치를 반대로 해줍니다. 
  
slice()  기존 배열의 일부를 추출하여 새로운 배열을 만들어 줍니다. 
  
sort()  배열을 정렬해 줍니다. 
math 객체
E  자연로그 밑에 사용하는 오일러 상수
  
LN10  10의 자연 로그 값
  
LN2  2의 자연 로그 값
  
LOG10E  밑이 10인 E로그
  
LOG2E  밑이 2인 E로그
  
PI  원주율
  
SQRT1_2  1/2의 제곱근
  
SQRT2  2의 제곱근
sin(x)  sine 함수를 계산합니다. 
  
cos(x)  cosine 함수를 계산합니다. 
  
tan(x)  tangent 함수를 계산합니다. 
  
asin(x)  arc sine 함수를 계산합니다. 
  
acos(x)  arc cosine 함수를 계산합니다. 
  
atan(x)  arc tangent 함수를 계산합니다. 
  
atan2(x,y)  제 2 arc tangent 함수를 계산합니다. 
  
abs(x)  절대 값을 계산합니다. 
  
exp(x)  지수 함수를 계산합니다. 
  
log(x)  로그 함수를 계산합니다. 
  
pow(x,y)  x의 y승을 계산합니다. 
  
sqrt(x)  제곱근을 계산합니다. 
  
random()  0에서 1사이의 난수를 발생합니다. 
  
round(x)  반올림합니다. 
  
floor(x)  x보다 같거나 작은 가장 큰 정수값을 계산합니다. 
  
ceil(x)  x보다 같거나 큰 가장 작은 정수값을 계산합니다. 
  
max(x,y)  x, y 중 큰 수를 계산합니다. 
  
min(x,y)  x, y 중 작은 수를 계산합니다. 
new 연산자를 사용하지 않는 객체들...
대부분의 객체들은 new 연산자를 사용해서 객체를 정의하지만 Math 객체는 new 연산자를 사용하지 않고 
바로 속성이나 메소드를 사용하는데요. 이처럼 new 연산자를 사용하지 않는 객체들을 정적 객체
(Static Object)라고 합니다. 정적 객체들은 new 연산자를 사용하면 오류가 발생하므로 주의하셔야 합니다. 
. Function 객체는 이처럼 함수를 사용하지 않고 객체로서 함수의 내용을 정의해 주는 
내부 객체입니다. 
function 객체란 함수를 사용하지 않고 객체로서 함수의 내용을 정의해 주는 내부 객체입니다.
 
 Function 객체의 형식
 
   a = new Function( 매개변수1, 매개변수2, 계산식)
브라우저 객체는 익스플로러나 넷스케이프와 같은 를 말하는 것으로
브라우저에 있는 문서, 상태 표시줄, 도구 모음과 같은 객체들의 정보를 가지고 다양한 효과를 낼 수 
있습니다. 
물론 브라우저의 최상위 객체는 이며, window 객체는 계층적인 구조로 되어 frames,
document, history와 같은 하위 객체가 존재합니다. 
지금 까지 사용했던 document.write()는 window 객체가 생략되어 사용되었으며 정확한 입력 방법은
window.document .write()이다. 하지만 매번 반복하여 사용 할 경우 상위객체를 생략하여 주로 사용됩니다.
Window 객체의 속성
익스플로러와 넷스케이프에서 지원하는 속성
classes  문서 내에 정의된 CSS 클래스들의 정보를 제공합니다. 
closed  윈도우가 닫혔는지를 나타냅니다. 
defaultStatus  status의 내용이 지정되지 않았을 때의 내용을 지정합니다. 
document  현재 윈도우에 있는 document객체를 반환합니다. 
frames  윈도우 객체 안에 들어간 프레임의 정보를 제공합니다. 
history  현재 윈도우에 있는 history 객체를 반환합니다. 
length  부모 윈도우의 frames개수를 나타냅니다. 
location  현재 윈도우에 있는 location객체를 반환합니다. 
name  윈도우의 이름을 지정합니다. 
opener  open() 메소드에 의해서 윈도우를 연 문서를 선택합니다. 
parent  상위 윈도우를 선택합니다.
self  현재의 윈도우를 선택합니다.
status  상태 표시줄의 내용을 지정합니다.
top  최상위 윈도우를 의미합니다.
     
  속성  설명
    
innerHeight  브라우저에서 내용을 볼 수 있는 창의 높이를 지정합니다. 
innerWidth  브라우저에서 내용을 볼 수 있는 창의 너비를 지정합니다. 
outerHeight  브라우저의 전체 창의 높이를 지정합니다. 
outerWidth  브라우저의 전체 창의 너비를 지정합니다. 
pageXOffset  윈도에 현재 나타나는 페이지의 X 위치를 지정합니다. 
pageYOffset  윈도에 현재 나타나는 페이지의 Y 위치를 지정합니다.
  
 이벤트핸들러  설명
    
onLoad()  문서가 Load될 때 발생합니다. 
onUnLoad()  문서가 unLoad될 때 발생합니다. 
onError()  문서 Load 중 에러가 나타나면 발생합니다. 
onBlur()  문서가 focus를 잃었을 때 발생합니다. 
onFocus()  문서가 focus를 얻었을 때 발생합니다. 
onDragDrop()  객체를 DragDrop 시켰을 때 발생합니다. 

     
  이벤트핸들러  설명
    
onMove()  윈도를 움직였을 때 발생합니다. 
onResize()  윈도의 크기를 바꾸었을 때 발생합니다.
함수에 정의해 놓은 내용으로 window.status를 마우스 핸들러에 직접 대입해서 사용해도 됩니다. 
이렇게 하면 불필요한 함수를 만들지 않아도 되기 때문에 작업을 편리하게 만들어 주는데요, 마우스 핸들러에
대입할 내용은 꼭 ""(큰 따옴표)를 해 주고 window.status에 대입할 글은 ''(작은 따옴표)를 사용해서 표시해
주면 됩니다. 
window객체는 최상위 객체로 모든 내장 객체는 window에서 시작됩니다. 따라서 모든 하위객체를 
   표기할  때는window객체 명을 입력해야 되지만 생략하여 사용되는 경우가 많습니다. 


 
 
 Window객체의 속성 
 
 속성  설 명
    
classes  문서 내에 정의된 CSS 클래스들의 정보를 제공합니다. 
    
closed  윈도우가 닫혔는지를 나타냅니다. 
    
defaultStatus  status의 내용이 지정되지 않았을 때의 내용을 지정합니다. 
    
document  현재 윈도우에 있는 document객체를 반환합니다. 
    
frames  윈도우 객체 안에 들어간 프레임의 정보를 제공합니다. 
    
history  현재 윈도우에 있는 history 객체를 반환합니다. 
    
length  부모 윈도우의 frames개수를 나타냅니다. 
    
location  현재 윈도우에 있는 location객체를 반환합니다. 
    
name  윈도우의 이름을 지정합니다. 
    
opener  open() 메소드에 의해서 윈도우를 연 문서를 선택합니다. 
    
parent  상위 윈도우를 선택합니다.
    
self  현재의 윈도우를 선택합니다.
    
status  상태 표시줄의 내용을 지정합니다.
    
top  최상위 윈도우를 의미합니다.


 

 
 Window객체의 이벤트 핸들러 
 
 이벤트핸들러  설 명
    
onLoad()  문서가 Load될 때 발생합니다. 
    
onUnLoad()  문서가 unLoad될 때 발생합니다. 
    
onError()  문서 Load 중 에러가 나타나면 발생합니다. 
    
onBlur()  문서가 focus를 잃었을 때 발생합니다. 
    
onFocus()  문서가 focus를 얻었을 때 발생합니다. 
    
onDragDrop()  객체를 DragDrop 시켰을 때 발생합니다. 



익스플로러에서만 지원되는 메소드는 다음과 같습니다. 
 
메소드 설명
 
open() 새로운 윈도를 엽니다. 
close() 열린 윈도를 닫습니다. 
alert() 메시지 창을 통해 메시지를 보여 줍니다. 
confirm() 확인 대화상자를 보여 줍니다.
prompt() 문자열을 입력 받을 수 있는 창을 보여 줍니다.
setTimeout() 지정된 시간이 지난 후에 명령을 수행합니다. 
clearTimeout() setTimeout()을 해제합니다. 
setInterval() 주기적으로 명령을 수행합니다.
moveBy() 윈도의 상대적인 이동을 설정합니다.
moveTo() 윈도의 절대적인 이동을 설정합니다.
resizeBy() 윈도의 상대적인 크기를 설정합니다.
resizeTo() 윈도의 절대적인 크기를 설정합니다.
scrollBy()  화면을 지정한 크기만큼 스크롤합니다.
ScrollTo() 화면을 지정한 위치로 스크롤합니다.
print() 윈도에 포함된 내용을 출력합니다.

넷스케이프에서만 지원되는 메소드는 다음과 같습니다. 


메소드  설명
  
stop  문서의 전송을 중지시킵니다.
  
back()  앞 페이지로 이동합니다.
  
forward()  뒤 페이지로 이동합니다.
  
home()  홈페이지로 이동합니다.
  
find()  윈도 안에 있는 텍스트를 검색합니다.
사실 내장 함수는 원래 window 객체에 포함되어 있는 메소드이므로 실제로는 window.alert()와 같이 
window를 붙여서 사용해야 하지만 생략하여 사용해도 됩니다.
창의 속성을 설정하는 매개 변수는 다음과 같습니다. 
   

속 성   설정값  설 명
    
toolbar  yes/no  툴바메뉴를 보이게 할지 설정합니다. 
    
location  yes/no   주소표시줄을 보이게 할지 설정합니다. 
    
directories  yes/no  연결표시줄을 보이게 할지 설정합니다. 
    
status  yes/no   상태표시줄이 보이게 할지 설정합니다. 
    
menubar  yes/no  메뉴를 보이게 할지 설정합니다. 
    
scrollbars  yes/no  스크롤바를 보이게 할지 설정합니다. 
resizable  yes/no  창 크기 조절을 허용할지를 설정합니다. 
    
copyhistory  yes/no  히스토리 정보를 저장할지 설정합니다. 
width  픽셀  창의 가로 길이를 설정합니다.
    
height  픽셀  창의 세로 길이를 설정합니다

<HTML>
     <HEAD>
     <TITLE> window객체의 메소드</TITLE>
     <SCRIPT LANGUAGE="Javascript">
     <!--
function test()
{
window.open("info.html",
           "안내문","status=yes")//location=yes
}

     //-->
     </SCRIPT>
     </HEAD>
     <BODY>
     <h4>안내문 버튼을 클릭해보세요</h4>
<form>
<input type="button" value="안내문"  onClick="test()">
</form>
      </BODY>
</HTML> 
Window객체의 메소드는 다음과 같습니다. 
 
 익스플로러에서 지원되는 메소드 
 
  메소드  설 명
  
open()  새로운 윈도를 엽니다. 
  
close()  열린 윈도를 닫습니다. 
  
alert()  메시지 창을 통해 메시지를 보여 줍니다.
  
confirm()  확인 대화상자를 보여 줍니다.
  
prompt()  문자열을 입력 받을 수 있는 창을 보여 줍니다.
  
setTimeout()  지정된 시간이 지난 후에 명령을 수행합니다. 
  
clearTimeout()  setTimeout()을 해제합니다. 
  
  
setInterval()  주기적으로 명령을 수행합니다. 
  
moveBy()  윈도의 상대적인 이동을 설정합니다. 
  
moveTo()  윈도의 절대적인 이동을 설정합니다. 
  
resizeBy()  윈도의 상대적인 크기를 설정합니다. 
  
resizeTo()  윈도의 절대적인 크기를 설정합니다. 
  
scrollBy()   화면을 지정한 크기만큼 스크롤합니다. 
  
ScrollTo()  화면을 지정한 위치로 스크롤합니다. 
  
print()  윈도에 포함된 내용을 출력합니다. 

 
 넷스케이프에서만 지원되는 메소드 
 
  메소드  설 명 
  
stop()  문서의 전송을 중지시킵니다. 
  
back()  앞 페이지로 이동합니다. 
  
forward()  뒤 페이지로 이동합니다. 
  
home()  홈페이지로 이동합니다. 
  
find()  윈도 안에 있는 텍스트를 검색합니다. 

* 2012년 01월 20일  : 5일차 강의 *
객체는 객체지향과 객체기반이라는 두 가지 종류가 있습니다. 
객체 지향이란 대상을 새롭게 만드는 것을 말하는 것이고, 객체기반은 만들어져 있는 것을 사용하는 
것을 말합니다. 
자바스크립트 언어는 함수를 이용해서 객체를 만들어 사용할 수 있기 때문에 객체지향(Object-Orient) 
언어에 속합니다.  

사용자 정의 객체, 내장 객체, 브라우저 객체(window 최상위 객체 : history, document,location)
new, del
내장객체로 정의 되어 있는 객체는 여러 가지 종류들이 있습니다. 그 중 가장 흔히 사용되고
많이 알려진 객체로는 Date, String, Math, Array, Screen, Event객체 등이 있습니다.
Date객체의 메소드는 다음과 같습니다.

메소드  설명
    
getYear()  '연도'(1970년 이후)를 알아냅니다. 
getMonth()  '월'(0=1월, 1=2월, ...)을 알아냅니다.
getDate()  '일'을 알아냅니다.
getDay()  '요일'(0=일요일, 1=월요일, ...)을 알아냅니다.
getHours()  '시'를 알아냅니다.
getMinutes()  '분'를 알아냅니다.
getSeconds()  '초'를 알아냅니다.
getTime()  1970년 1월 1일 이후의 시간을 1000분의 1초로 알아냅니다.
getYear()  '연도'(1970년 이후)를 변경합니다. 
getMonth()  '월'(0=1월, 1=2월, ...)을 변경합니다. 
getDate()  '일'을 변경합니다. 
setDay()  '요일'(0=일요일, 1=월요일, ...)을 변경합니다. 
setHours()  '시'를 변경합니다. 
setMinutes()  '분'를 변경합니다. 
setSeconds()  '초'를 변경합니다. 
getMonth메소드에 +1이 입력되어 이유는?
getMonth는 월을 구하는 메소드로 여기에 +1을 해주는 이유는 자바스크립트에서는 0부터 월을 counter하기
때문입니다. 즉, 1월은 0으로 2월은 1로 출력이 되기때문에 +1을 해주셔야지만 제대로 된 출력문을 보실 수
있는 것입니다
넷스케이프는 한글을 2자리로...
length 속성을 사용한 string 객체는 웹 브라우저마다 계산 값에 차이가 있습니다. 익스플로러에서는 
한글과 영문 모두 한글자의 길이를 1로 계산합니다. 하지만 넷스케이프에서는 영문 한글자의 길이는 1,
한글 한글자의 길이는 2로 계산합니다. 
빈칸도 계산 되나요?

네, 물론입니다. 빈 칸의 길이도 1로 계산됩니다.
a.link("http://www.naver.com/");
String 객체의 메소드는 문자열 처리에 관한 메소드로 다음과 같습니다.

메소드  기능
    
CharAt()  인덱스 위치의 문자를 알아내는 메소드입니다. 
CharCodeAt()  인덱스 위치의 문자를 ISO-Latin-1 코드로 변환하는 메소드입니다.
fromcharCode()  ISO-Latin-1 코드를 문자로 변환해 주는 메소드입니다. 
concat()  문자열에 내용을 추가할 때 사용되는 메소드입니다. 
indexOf()  찾는 문자열의 첫 인덱스 위치를 알아내는 메소드입니다.
lastIndexOf()  찾는 문자열의 마지막 인덱스위치를 알아내는 메소드입니다. 
slice()  문자열의 순서에 따라 분리해 주는 메소드입니다. 
split()  매개변수의 입력기준에 따라 문자열을 분리해 주는 메소드입니다. 
Substring()  매개변수의 입력기준에 따라 문자열을 나타내 주는 메소드입니다. 
substr()  매개변수의 입력기준에 따라 문자열을 나타내 주는 메소드입니다. 
toLowerCase()  문자열을 소문자로 바꿔 주는 메소드입니다. 
toUpperCase()  문자열을 대문자로 바꿔 주는 메소드입니다.
"문자열".substr(a,c)   
    ☞ 문자열에서 a번째 문자부터 c번의 문자의 길이를 표시합니다.
"문자열".substring(a,b)
    ☞ 문자열에서 a번째 문자부터 b번째까지의 문자열을 표시하며,
       음수값은 무시됩니다.
"문자열".slice(a,b)    
    ☞ 문자열에서 a번째 문자부터 b번째까지의 문자열을 표시하며,
       음수값은 문자의 끝부분부터 역순의 값이 지정됩니다.
"문자열".toLowerCase()   
       ☞ 문자열을 모두 소문자로 변환해 줍니다.
"문자열".toUpperCase()   
       ☞ 문자열을 모두 대문자로 변환해 줍니다. 
Screen 객체란 컴퓨터의 를 구해주는 내장객체입니다. 보통 방문자의 해상도나
색상 정보를 얻어서 최적의 상태로 내용을 표시할 경우에 사용됩니다. Screen 객체는 를 
사용해서 객체를 정의 하지 않습니다. 
     
  Screen 객체의 속성은 다음과 같습니다.

속성  의미
  
heigth  화면의 높이를 픽셀단위로 알려 줍니다. 
  
width  화면의 너비를 알려 줍니다.
  
availHeight  제목 표시줄, 메뉴 표시줄, 도구 모음을 제외한 실제 화면의 높이를
알려 줍니다.
  
availWidth  실제 화면의 너비를 알려 줍니다.
  
pixelDepth  한 픽셀당 비트수를 알려 줍니다. 
colorDepth  사용 가능한 색상수를 알려 줍니다.

 screen.pixelDepth 속성은요...
screen.pixelDepth은 넷스케이프에서만 지원되는 속성이기 때문에 익스플로러에서는 undefined라고 
출력됩니다. 
 Event객체는 홈페이지에서 발생하는 여러 가지 해 주는 
객체입니다. 마우스 움직임에 따른 효과나 키보드의 누름에 따른 효과들을 설정할 때 사용이 되는데요,
Event객체는 익스플로러와 넷스케이프에서 지원하는 내용이 다르기 때문에 웹 브라우저 별로 나누어서 
내용을 작성해야 합니다. 
 
     
  익스플로러에서는 event라는 객체에 속성이나 메소드에 '.'연산자를 사용해서 입력하지만 넷스케이프  
  에서는 이벤트를 정의해 주는 함수의 매개변수를 객체로 설정해서 사용해야 합니다.   
      
  [익스플로러]
 
 
window.event.속성 또는 메소드
 
 
[넷스케이프]
 
 
매개변수.속성 또는 메소드
 Event객체의 속성은 다음과 같습니다.  
    
  메소드  기능
    
altKey  alt 키를 눌렀을 때 발생 합니다. 
altLeft  왼쪽 alt키를 눌렀을 때 발생 합니다. 
button  마우스 버튼을 눌렀을 때 발생 합니다. (1=왼쪽, 2=오른쪽, 3=양쪽)
clientX  윈도우에서 실제 데이터 영역을 기준으로 마우스의 x좌표의 위치를
알려줍니다. 
clientY  윈도우에서 실제 데이터 영역을 기준으로 마우스의 y좌표의 위치를
알려줍니다. 
ctrlKey  ctrl키를 눌렀을 때 발생 합니다. 
ctrlLeft  왼쪽 ctrl키를 눌렀을 때 발생 합니다. 
shiftKey  shift키를 눌렀을 때 발생 합니다. 
shiftLeft  왼쪽 shift키를 눌렀을 때 뱔생 합니다. 
scrElement  이벤트를 발생한 객체를 설정 합니다. 
type  이벤트 객체의 이벤트 이름을 설정 합니다. 
x  선택한 객체의 x 좌표를 위치를 알려줍니다. 
y  선택한 객체의 y 좌표를 위치를 알려줍니다. 
 * 2012년 01월 19일  : 4일차 강의 *
prompt
confirm
continue는 아래를 실행하지 않고 조건문으로 다시
가게 됨
FUNCTION  ==> <HEAD> 태그안에 넣음 . 실행 구문 보다 앞에 위치해야함
실행 구문은 자바스트립트 구문 사용하야 <BODY>태그안에 넣어야 함
var 입력 : 지역변수 : => 입력하지 않으면 전역변수
alert() : 확인
confirm() : 확인 , 취소
prompt() : 입력
eval(), 문자열을 수식으로
isNaN() : 숫자여부
parseFloat() : 문자열을 부동소수점으로
parseInt() : 문자열을 정수로
escape() : ISO-Latin-1문자셋을 아스키 값으로
unescape() : 아스키값을 ISO-Latin-1문자셋으로
동적인 효과 : 이벤트
이벤트 핸들러 : 이벤트 발생시 처리 함수

click  onClick  객체를 클릭했을 때 발생합니다. 
    
dblclick  onDblclick  객체를 더블클릭했을 때 발생합니다. 
    
dragdrop  onDragdrop  드래그했을 때 발생합니다. 
    
mouseover  onMouseover  객체 위에 마우스 포인터가 위치했을 때 발생합니다. 
    
mouseout  onMouseoutA+B   객체에서 마우스 포인터가 벗어 났을 때 발생합니다.
    
mousedown  onMousedown  마우스 버튼을 눌렀을 때 발생합니다. 
    
mousemove  onMousemove  마우스를 움직였을 때 발생합니다. 
    
mouseup  onMouseup  마우스 버튼을 눌렀다 놓았을 때 발생합니다. 
    
keydown  onKeydown  키를 입력했을 때 발생합니다. 
keypress  onKeypress  키를 눌렀을 때 발생합니다. 
    
keyup  onKeyup  키를 눌렀다 놓았을 때 발생합니다. 
    
load  onLoad  문서를 열었을 때 발생합니다. 
    
unload  onUnload  문서를 닫았을 때 발생합니다. 
    
focus  onFocus  객체 안에 포커스가 들어 왔을 때 발생합니다.
    
blur  onBlur  객체 안에 있던 포커스가 다른 곳으로 이동했을 때 발생합니다. 
    
abort  onAbort  이미지를 읽다가 중단 시켰을 때 발생합니다. 
    
error  onError  에러가 생겼을 때 발생합니다. 
    
reset  onReset  reset 시켰을 때 발생합니다. 
    
move  onMove  윈도나 프레임을 움직였을 때 발생합니다. 
    
resize  onResize  윈도나 프레임의 크기를 조절했을 때 발생합니다. 
    
select  onSelect  입력 양식의 한 필드를 선택했을 때 발생합니다. 
    
change  onChange  입력된 값이 바뀌었을 때 발생합니다. 
    
submit  onSubmit  입력 양식을 서버로 보냈을 때 발생합니다.
<FORM NAME="form1" METHOD=POST>
<INPUT TYPE="button" NAME="button1" VALUE="버튼1" onClick="btn()">
<INPUT TYPE="button" NAME="button2" VALUE="버튼2" ondbClick="btn1()">
<textarea rows="15" cols="50" onmouseOut="alert('onmouseOut')">

   
 는 ISO-Latin-1 문자 세트를 ASCⅡ형태로 바꾸어 리턴하는 함수로 
이때 리턴값은 '%OO'의 형태로 나오게 되는데, 여기서 OO는 ASCⅡ형태입니다. 
예를들면, escape("&") 함수의 리턴값은 '%26'이 되고, escape("!#")의 리턴값은 '%21%23'이 되는 것입니다

는 ASCⅡ형태를 ISO-Latin-1로 바꾸어 리턴하는 함수입니다. 
예를들면, unescape("%26") 함수의 리턴값은 '%&'이 되고, unescape("%21%23")의 리턴값은 '!#'이 되는 
것입니다.

ASCⅡ code(아스키 코드)란?
아스키 코드란 1963년 미국표준협회(ASA)에 의해 결정되어 미국의 표준부호로 미니 컴퓨터나 
개인용 컴퓨터(PC)와 같은 소형 컴퓨터를 중심으로 보급되어 현재 국제적으로 널리 사용되고 있습니다. 
아스키는 128개의 가능한 문자조합을 제공하는 7비트(bit) 부호로, 처음 32개의 부호는 인쇄와

전송 제어용으로 사용됩니다. 보통 기억장치는 8비트(1바이트, 256조합)이고, 아스키는 단지 128개의 문자만

사용하기 때문에 나머지 비트는 패리티 비트나 특정문자로 사용됩니다.

일반적으로 컴퓨터는 데이터를 8개의 비트 단위로 묶어 한 번에 처리하는데 비트는 2진법의 0과 1 가운데

하나를 나타내는 단위입니다. 즉, 1비트는 0이 될 수도 있고, 1이 될 수도 있습니다.

비트 8개를 모아 놓은 것을 바이트(byte)라고 부릅니다. 그러므로 1바이트로 표시할 수 있는 최대 문자의 수는

256조합이 됩니다

따라서 컴퓨터에서는 8비트씩을 묶어 처리하는 것이 가장 효율적입니다. 예컨대 7개 비트 이하로 묶을 경우엔
는 표현 가능한 수가 128이 됩니다. 그러나 이 숫자로는 세계 여러 나라에서 사용하는 모든 숫자·국가언어·
기호 등을 충분히 표현할 수 없다. 반면에 9비트 이상일 경우에는 512가지나 되어 필요없는 영역이 많이 
생기게 됩니다. 이 때문에 256가지의 영역마다 어떤 원칙에 의해 표현 가능한 모든 숫자·문자·특수문자를 
하나씩 정해 놓은 것이 곧 아스키코드입니다. 
 * 2012년 01월 05일  : 3일차 강의 *
alert("어서오세요\n하이")
prompt("입력하세요","hint")

i = confirm("확인 또는 취소 누름")
if(i==true)
else

 * 2012년 01월 04일  : 2일차 강의 *
Null : 정의 안됨, 아무 값도 없는 의미
Undefined : 변수 선언후 값 할당 안함
NaN : Not a Number : 숫자가 아님
Infinity : 매우 큰값, 무한대

변수 이름 = 값
var 변수 이름 = 값
var a = "안녕"

document.write("<h3>뺄샘"+a+"-"+b</h3>+<p>")

단항연산자 : +A => (+1)A


A%B : A에서 B를 나눈값의 나머지를 표시해 줍니다.
A_B
A_=B A=A_B

한글자음 ㅁ + 한자키

 * 2012년 01월 03일  : 1일차 강의 *
라이브 스크립트 (넷스케이프)
java+라이브 스크립트 => 자바 스크립트
현재 브라우저에서 사용가능한 플러그인을 테스트 함
내장 객체 사용
<HTML>
<HEAD>
<TITLE> 제목 입력 </TITLE>
<SCRIPT LANGUAGE="Javascript"> ==> VBScript or JScript
  <!--


  //-->
/*
*/
//

document.write("Hello world")
</SCRIPT>
</HEAD>

<BODY>
</BODY>
</HTML>
document.write("Hello world")
SCRIPT 태그는 head 태그나 body안에 넣어도 되나 대체로 head로 넣는다.(에러시 대비)
대, 소문자 구별함