ソース掲示板




すべてから検索

キーワード   条件 表示 現行ログ 過去ログ トピックス 名前 本文
ASP用ツリー作成パッケージ
日時: 2013/05/01 23:23
名前: lightbox



http://lightbox.on.coocan.jp/download/make_tree_for_asp.lzh

↓結果サンプル
http://lightbox.on.coocan.jp/html/make_tree_result.htm
メンテナンス

パッケージコード ( No.1 )
日時: 2007/10/01 16:23
名前: lightbox


日時: 2007/10/01 16:23
名前: lightbox
  tree.inc
<%

' **********************************************************
' 初期処理
' **********************************************************
Function InitializeTreeEnv( )

	ExecuteGlobal "Dim tree_imageurl : Dim tree_nid : Dim tree_lv"

	tree_nid = 0
	tree_lv = 0

End Function

' **********************************************************
' 画像URL変更
' **********************************************************
Function SetImageUrl( url )

	tree_imageurl = url & "/"

End Function

' **********************************************************
' 専用javaScript 出力
' **********************************************************
Function SetControlJs( )

	Dim str

	str=""
	str=str&"function TreeControl(id,gid) {  "&vbCrLf&"  "
	str=str&""&vbCrLf&"	if ( !document.getElementById(id).flg "
	str=str&") {  "&vbCrLf&"		document.getElementById(id).flg "
	str=str&"= ""1"";  "&vbCrLf&"	}  "&vbCrLf&"  "&vbCrLf&"	if "
	str=str&"( document.getElementById(id).flg == ""1"" "
	str=str&") {  "&vbCrLf&"		document.getElementById(id).style.display=""""; "
	str=str&" "&vbCrLf&"		document.getElementById(id).flg "
	str=str&"= ""0"";  "&vbCrLf&"		gid.src = """ & tree_imageurl & "m.png"" "
	str=str&" "&vbCrLf&"	}   "&vbCrLf&"	else {  "&vbCrLf&"		document.getElementById(id).style.display=""none""; "
	str=str&" "&vbCrLf&"		document.getElementById(id).flg "
	str=str&"= ""1"";  "&vbCrLf&"		gid.src = """ & tree_imageurl & "p.png"" "
	str=str&" "&vbCrLf&"	}  "&vbCrLf&"  "&vbCrLf&"}  "&vbCrLf&" "
	str=str&""

	Response.Write str

End Function

' **********************************************************
' ノード開始部分作成
' **********************************************************
Function StartNode( url, title, target )

	Dim Buffer
	Dim nVOffset,nTitleOffset,I

	tree_nid = tree_nid + 1
	tree_lv = tree_lv + 1

	nTitleOffset = ((tree_lv-1)*2-20)*-1

	if tree_lv = 1 then
		Buffer = Buffer & "<DIV style='position:relative;left:0px'" & vbCrLf & ">"
	else
		Buffer = Buffer & "<DIV style='position:relative;left:21px'" & vbCrLf & ">"
	end if

	Buffer = Buffer & "<IMG src=""" & tree_imageurl & "p.png"""
	Buffer = Buffer & " onClick='TreeControl(""" & tree_nid & """, this)' border=""0"" style='position:relative;left:4px'" & vbCrLf & ">"
	Buffer = Buffer & "<IMG src=""" & tree_imageurl & "folder.png"" style='position:relative;left:12px'" & vbCrLf & ">"

	For I = 2 to tree_lv
		nVOffset = -39 - 24*(I-2)
		Buffer = Buffer & "<IMG style='position:relative;left:" & nVOffset & "px;' align=""top"" src=""" & tree_imageurl & "l3.gif"" border=""0""" & vbCrLf & ">"
	Next 

	Buffer = Buffer & "<A style='text-decoration:none;position:relative;left:" & nTitleOffset & "px;'"
	Buffer = Buffer & " href=""" & url & """ target=""" & target & """>" & title & "</A><br>" & vbCrLf

	Buffer = Buffer & "<DIV style='position:relative;left:0px;display:none;' id=""" & tree_nid & """ flg=""1""" & vbCrLf & ">"

	StartNode = Buffer

End Function

' **********************************************************
' ノード終了部分作成
' **********************************************************
Function EndNode(  )

	Dim Buffer

	tree_lv = tree_lv - 1

	Buffer = Buffer & "</DIV></DIV>" & vbCrLf

	EndNode = Buffer

End Function

' **********************************************************
' 末端データ部分作成
' **********************************************************
Function AddLeaf( url, title, target, bLast )

	Dim Buffer

	Dim nVOffset,nTitleOffset,I

	nTitleOffset = ((tree_lv-1)*3-25)*-1

	Buffer = Buffer & "<IMG style='position:relative;left:8px;' align=""top"" src=""" & tree_imageurl & "l3.gif"" border=""0""" & vbCrLf & ">"
	if bLast then
		Buffer = Buffer & "<IMG style='position:relative;left:18px;'align=""top"" src=""" & tree_imageurl & "l2.gif"" border=""0""" & vbCrLf & ">"
	else
		Buffer = Buffer & "<IMG style='position:relative;left:18px;'align=""top"" src=""" & tree_imageurl & "l.gif"" border=""0""" & vbCrLf & ">"
	end if
	Buffer = Buffer & "<IMG style='position:relative;left:20px;top:3px;' align=""top"" src=""" & tree_imageurl & "note.png"" border=""0""" &vbCrLf & ">"
	For I = 2 to tree_lv
		nVOffset = -47 - 24*(I-2)
		Buffer = Buffer & "<IMG style='position:relative;left:" & nVOffset & "px;' align=""top"" src=""" & tree_imageurl & "l3.gif"" border=""0""" & vbCrLf & ">"
	Next 
	Buffer = Buffer & "<A style='position:relative;left:" & nTitleOffset & "px;top:2px;text-decoration:none;font-size:14px;'"
	Buffer = Buffer & " href=""" & url & """ target=""" & target & """>" & title & "</A><br>" & vbCrLf

	AddLeaf = Buffer

End Function


%>
このアーティクルの参照用URLをクリップボードにコピー メンテナンス
サンプルコード ( No.2 )
日時: 2007/10/01 16:23
名前: lightbox
<!-- #include file = "tree.inc" -->
<HTML>
<HEAD>
<META http-equiv="Content-type" content="text/html; charset=Shift_JIS">
<TITLE>HTML テンプレート</TITLE>
<STYLE type="text/css">
* {
	font-family: "MS Pゴシック";
	font-size: 12px;
}
BODY {
	background-color: white;
	color: black;
}
</STYLE>

<SCRIPT language="javascript" type="text/javascript">

<%
	Call InitializeTreeEnv()
	Call SetImageUrl( "image" )
	Call SetControlJs( )
%>

</SCRIPT>
<HEAD>
<%


Dim Tree

Tree = Tree & StartNode( "#", "ルートノード", "_self" )
Tree = Tree & AddLeaf( "http://www.google.co.jp/", "Google", "ActionWindow", False )
Tree = Tree & AddLeaf( "http://www.yahoo.co.jp/", "Yahoo", "ActionWindow", False )
Tree = Tree & AddLeaf( "http://www.google.co.jp/", "Google", "ActionWindow", False )
Tree = Tree & AddLeaf( "http://www.yahoo.co.jp/", "Yahoo", "ActionWindow", True )
Tree = Tree & EndNode( )

Tree = Tree & StartNode( "#", "ルートノード", "_self" )
Tree = Tree & AddLeaf( "http://www.google.co.jp/", "Google", "ActionWindow", False )
Tree = Tree & AddLeaf( "http://www.yahoo.co.jp/", "Yahoo", "ActionWindow", False )

	Tree = Tree & StartNode( "#", "ノード", "_self" )
	Tree = Tree & AddLeaf( "http://www.google.co.jp/", "Google", "ActionWindow", False )
	Tree = Tree & AddLeaf( "http://www.google.co.jp/", "Google", "ActionWindow", False )


		Tree = Tree & StartNode( "#", "ノード", "_self" )
		Tree = Tree & AddLeaf( "http://www.google.co.jp/", "Google", "ActionWindow", False )
		Tree = Tree & AddLeaf( "http://www.yahoo.co.jp/", "Yahoo", "ActionWindow", False )
		Tree = Tree & AddLeaf( "http://www.google.co.jp/", "Google", "ActionWindow", False )
		Tree = Tree & AddLeaf( "http://www.google.co.jp/", "Google", "ActionWindow", True )
		Tree = Tree & EndNode( )


	Tree = Tree & AddLeaf( "http://www.google.co.jp/", "Google", "ActionWindow", False )
	Tree = Tree & AddLeaf( "http://www.yahoo.co.jp/", "Yahoo", "ActionWindow", True )
	Tree = Tree & EndNode( )

Tree = Tree & AddLeaf( "http://www.google.co.jp/", "Google", "ActionWindow", False )
Tree = Tree & AddLeaf( "http://www.yahoo.co.jp/", "Yahoo", "ActionWindow", True )
Tree = Tree & EndNode( )

%>
<BODY>
<%= Tree %>

<IFRAME
	style='position:absolute;left:300px;top:15px;'
	src="iframe.htm"
	name="ActionWindow"
	frameborder="yes"
	scrolling="yes"
	width="650"
	height="500"
></IFRAME>

</BODY>
</HTML>
このアーティクルの参照用URLをクリップボードにコピー メンテナンス