js파일에 값을 넣기 또는 전달 할 수 없을까요? 정보
js파일에 값을 넣기 또는 전달 할 수 없을까요?
본문
1.html?id=aaa
이렇게 접속했을시 js에 값을 넣을방법 또는 값을 전달 할 수 있을까요?
--------------------------------------------------------------------
1.html내용
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=euc-kr">
<title>title</title>
<script type="text/javascript" src="1.js"></script>
</head>
<body>
본문
</body>
</html>
--------------------------------------------------------------------
1.js 내용
<script type="text/javascript">
.....
.....
var id = aaa를 여기 받기
.....
.....
</script>
--------------------------------------------------------------------
1.html에 아래처럼 자바소스를 넣고하면 되는데 위와 같이 js파일을 불러서하니 안되네요.
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=euc-kr">
<title>title</title>
<script type="text/javascript">
.....
.....
var id = aaa를 여기 받기
.....
.....
</script>
</head>
<body>
본문
</body>
</html>
0
댓글 4개
이렇게 하고 웹프로그램이 js파일에서 작동 될수 있도록
환경 설정을 바꿔 주면 됩니다.
js 내용
<script type="text/javascript">
.....
.....
var id = <?=$_GET['aaa']?>;
.....
.....
</script>

근데요
이렇게 하고 웹프로그램이 js파일에서 작동 될수 있도록 환경 설정을 바꿔 주면 됩니다.
이게 무슨 말씀인지요?

<IfModule mime_module>
AddType application/x-httpd-php .php .php4 .php3 .html .htm
끝에 .js 추가하시면 됩니다.
