JavaScript

javascript만으로 html간 변수값 주고받기

tomato13 2011. 6. 16. 09:11

http://blog.naver.com/music_2004?Redirect=Log&logNo=120121496301


1. 보내는 html

<script language = "javascript">

name = "Hey"

content = "Fighting!!!"

location.href="5.html?" + name + ":" + content

</script>


</body>


2. 받는 html

<script language = "javascript">

temp = location.href.split("?");

data=temp[1].split(":");

name = data[0];

content = data[1];

document.write(name + " " + content);

</script>

'JavaScript' 카테고리의 다른 글

j query mobile: changePage  (0) 2011.06.16
j query mobile: swipe  (0) 2011.06.16
innerHTML  (0) 2011.06.10
mouse의 각 버튼의 눌림을 감지하는 이벤트 처리 예  (0) 2011.06.10
슬라이드쇼  (0) 2011.06.10