2012-01-18 3 views
0

데이터를 표 형식으로 표시하려고합니다. 그러나 테이블은 동적이어야하므로 표시된 데이터 목록에 따라 더 많거나 적은 행을 수용합니다. 나는 Raphael.js와 함께하고 싶다. 그래서 나는 효과를 엉망으로 만들 수있다. 그러나 평범한 Jane은 지금 충분히 좋다. 2 개의 행과 2 개의 열이있는 예제로 충분합니다.자바 스크립트를 통해 DIV 동적 데이터를 테이블 형식으로 오버레이합니다.

이제 div 안에 정적 테이블을 만드는 방법을 알고 있지만 JavaScript로 기존 페이지를 오버레이해야합니다.

내가 지금까지 할 수 있었던 모든

는 마지막 행이 작동하지 않고 DIV 또는 내용이 표시되지 않습니다이

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>TESTING CODE</title> 

<script language="JavaScript" type="text/javascript"> 
    function routeIt (kontent, zPath) { 
     if (zPath == 'Meeting') { 
      var ta1 = document.createElement('div'); 
      ta1.setAttribute("name","travel"); 
      ta1.setAttribute("id","mobile"); 
      ta1.setAttribute("style","position:float"); 
      ta1.setAttribute("id","mobile"); 
      ta1.setAttribute("width","600"); 
      ta1.setAttribute("height","100"); 
      ta1.setAttribute("left","120"); 
      ta1.setAttribute("top","320"); 
      document.getElementById.('mobile').innerHTML = 'This venerable day of march the 42nd I pledge to uphold the traditions of all the welders...'; 
    } 
</script> 
</head> 
<body> 
    <a class="linqs" href="javascript:routeIt('Hello','Meeting') "><span title="Make comments about the Meeting...">Meetings</span></a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    <a class="linqs" href="javascript:routeIt('Tzigane','Resolution')"><span title="Make comments about your Portfolio...">Portfolio</span></a>&nbsp;&nbsp;&nbsp;&nbsp; 
    <a class="linqs2" href="javascript:routeIt('Kratt','SendEmail') "><span title="Emails from ...">Email</span></a> 
</body> 
</html> 

입니다 ...하지만 DIV를 만드는 실수를 범하지 않습니다. 그래서, 나는 DIV를 불러올조차 수 없었다. 다음과 같이

데이터 목록

이오고있다 :

어떤 도움을 주시면 감사하겠습니다

zList1 = [['zebra','24'],['cat','153'],['paycheck','$123.56']] 
zList2 = [['Wine','gloogloo'],['cereal','bowl'],['garage','three cars']] 
...

데니스

+0

당신은에 (추가) 텍스트 영역을 추가 했 페이지. 내 생각 엔 엘리먼트를 페이지에 추가하는 것입니다. 스 니펫에서 문장이 누락되었습니다. 건배 Arun – iDroid

+0

추가 하시겠습니까? 나는 자바 스크립트입니다! CreateElement는 추가가 필요합니까? 언제부터? – DeKoss

+0

document.getElementById (Your_Target_Element_Should_be_here) .appendChild (ta1); 새 div를 만들고 속성을 사용하여 사용자 정의했지만 페이지에 추가하는 것을 잊어 버렸습니다. – iDroid

답변

0
Here is The Bug Fixed code: Try and post the comment, 


    function routeIt (kontent, zPath) { 
     if (zPath == 'Meeting') { 
      var ta1 = document.createElement('div'); 
      ta1.setAttribute("name","travel"); 
      ta1.setAttribute("id","mobile"); 
      ta1.setAttribute("style","position:float"); 
      ta1.setAttribute("id","mobile"); 
      ta1.setAttribute("width","600"); 
      ta1.setAttribute("height","100"); 
      ta1.setAttribute("left","120"); 
      ta1.setAttribute("top","320"); 
      document.getElementById("bodyID").appendChild(ta1); 
      document.getElementById.('mobile').innerHTML = 'This venerable day of march the 42nd I pledge to uphold the traditions of all the welders...'; 
} 
    } 


add id="bodyID" to the the body tag definition. 

Cheers, Arun 
관련 문제