jQuery | javascript | CSS

javascript 전역 변수 사용하기

Godffs 2017. 1. 10. 15:13
반응형

자바스크립트에서 전역변수를 선언하여 선언한 변수에 값을 넣어 이미지를 불러와야 하는 작업이 필요했다...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<!DOCTYPE html>
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    
        <%
                String uris = "http://godffs.tistory.com";
        %>
 
        <script type="text/javascript">
            document.write("<%= uris %>");
        </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
            
    </div>
    </form>
</body>
</html>
 
cs
결과화면




어때요~?

참 쉽죠~?

끝~




반응형