DDR爱好者之家 Design By 杰米
看老大介绍的dojo框架,学习着写了下。刚开始学习php 请大家指教下!发现发不了附件。发两个代码大家自己体会了。
复制代码 代码如下:
<?php
session_start();
if ($_SESSION['gh']==''){
header('location:login.php');
}
include("config.php");
$sql="select * from module";
$result=mssql_query($sql,$conn);
$num=mssql_num_rows($result);
//echo $num;
?>
<style type="text/css">
<!--
#container0 {
border:1px dotted #990033;
height: 10px;
margin: 10px;
}
-->
</style>
<script type="text/javascript" src="/UploadFiles/2021-04-02/dojo.js"><script type="text/javascript">
//引用以下两个dojo包
dojo.require("dojo.style");
dojo.require("dojo.dnd.*");
function init(){
//利用classname取到元素列表,将其注册为dojo.dnd.HtmlDragSour
var arr=dojo.html.getElementsByClass('divdrag')
for(var i=0;i<arr.length;i++){
var parentDiv=arr.parentNode.id
new dojo.dnd.HtmlDragSource(arr,parentDiv);
}
//定义容器
new dojo.dnd.HtmlDropTarget("container0", ["container0",<?php for ( $p = 1 ; $p <= $num ; $p ++) {
echo '"'.'container'.$p.'"';
if ($p != $num){
echo ",";
}
}
echo ']); ';
for ($p =1 ; $p <=$num ;$p++){
echo chr(13).'new dojo.dnd.HtmlDropTarget("container'.$p.'", ["container0",';
for ($o =1 ;$o <= $num;$o++){
echo '"container'.$o.'"';
if ($o != $num){
echo ",";
}
}
echo ']); ';
}
echo chr(13);
?>
}
//增加到window.onload事件中
window.onload=function(){init();}
function bjsave() {
gr=""
<?php
$sql='select id from module';
$result=mssql_query($sql,$conn);
while($myrow=mssql_fetch_array($result))
echo 'if (mokuai'.$myrow['id'].'.parentElement.id !="container0") {'.chr(13).'gr=gr+'.$myrow['id'].'+"|"+ mokuai'.$myrow['id'].'.parentElement.id+ "$"'.chr(13).'}'.chr(13);
?>
form1.gr.value=gr;
form1.submit();
}
</script>
<div id="overDiv" STYLE="position:absolute; visibility:hide; z-index: 1;"></div>
<div id="container0">
<?php
$sql='select * from module where id not in (select mokuaiid from geren where gh ='.$_SESSION['gh'].')';
$result=mssql_query($sql,$conn);
while($myrow=mssql_fetch_array($result))
echo '<span class="divdrag" id="mokuai'.$myrow['id'].'" style="border:1px dotted #990033;height: 20px;width:100px;margin: 5px; " title="'.$myrow['mmark'].'">'.$myrow['mn'].'</span>';
?>
</div>
<table width="98%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="150" valign="top">
<?php
for ($p=1; $p<=$num;$p=$p+2){
echo '<div id="container'.$p.'" style="border:1px dotted #990033;height: 100px;margin: 10px; ">';
$sql='select mokuaiid from geren where biaogeid='.$p.' and gh ='.$_SESSION['gh'];
$result=mssql_query($sql,$conn);
while($myrow=mssql_fetch_array($result)){
$sql='select * from module where id='.$myrow['mokuaiid'];
$result1=mssql_query($sql,$conn);
while($myrow1=mssql_fetch_array($result1)){
echo '<span class="divdrag" id="mokuai'.$myrow1['id'].'" style="border:1px dotted #990033;height: 20px;width:100px;margin: 5px; " title="'.$myrow1['mmark'].'">'.$myrow1['mn'].'</span>';
}
}
echo '</div>';
}
?></td>
<td width="150" valign="top">
<?php
for ($p=2; $p<=$num;$p=$p+2){
echo '<div id="container'.$p.'" style="border:1px dotted #990033;height: 100px;margin: 10px; ">';
$sql='select mokuaiid from geren where biaogeid='.$p.' and gh ='.$_SESSION['gh'];
$result=mssql_query($sql,$conn);
while($myrow=mssql_fetch_array($result)){
$sql='select * from module where id='.$myrow['mokuaiid'];
$result1=mssql_query($sql,$conn);
while($myrow1=mssql_fetch_array($result1)){
echo '<span class="divdrag" id="mokuai'.$myrow1['id'].'" style="border:1px dotted #990033;height: 20px;width:100px;margin: 5px; " title="'.$myrow1['mmark'].'">'.$myrow1['mn'].'</span>';
}
}
echo '</div>';
}
?>
</td>
</tr>
</table>
<input type="button" name="Submit" value="保存布局" onclick="bjsave();" />
<form id="form1" name="form1" method="post" action="savegr.php">
<input name="gr" type="hidden" value="" />
</form>
复制代码 代码如下:
<?php
session_start();
if ($_SESSION['gh']==''){
header('location:login.php');
}
include("config.php");
$sql='delete from geren where gh='.$_SESSION['gh'];
mssql_query($sql);
$gr=str_replace("container","",$_POST['gr']);
//echo $gr;
$array = explode("$", $gr);
for ($i=0;$i<=count($array)-2;$i++){
$add=explode("|",$array[$i]);
$sql='insert into geren (mokuaiid,biaogeid,gh) values ("'.$add[0].'","'.$add
[1].'","'.$_SESSION['gh'].'")';
//echo $sql.'<br>';
mssql_query($sql);
}
header("location:view.php");
?>
dojo 这里下载 http://download.dojotoolkit.org/release-0.3.1/dojo-0.3.1-ajax.zip
复制代码 代码如下:
<?php
session_start();
if ($_SESSION['gh']==''){
header('location:login.php');
}
include("config.php");
$sql="select * from module";
$result=mssql_query($sql,$conn);
$num=mssql_num_rows($result);
//echo $num;
?>
<style type="text/css">
<!--
#container0 {
border:1px dotted #990033;
height: 10px;
margin: 10px;
}
-->
</style>
<script type="text/javascript" src="/UploadFiles/2021-04-02/dojo.js"><script type="text/javascript">
//引用以下两个dojo包
dojo.require("dojo.style");
dojo.require("dojo.dnd.*");
function init(){
//利用classname取到元素列表,将其注册为dojo.dnd.HtmlDragSour
var arr=dojo.html.getElementsByClass('divdrag')
for(var i=0;i<arr.length;i++){
var parentDiv=arr.parentNode.id
new dojo.dnd.HtmlDragSource(arr,parentDiv);
}
//定义容器
new dojo.dnd.HtmlDropTarget("container0", ["container0",<?php for ( $p = 1 ; $p <= $num ; $p ++) {
echo '"'.'container'.$p.'"';
if ($p != $num){
echo ",";
}
}
echo ']); ';
for ($p =1 ; $p <=$num ;$p++){
echo chr(13).'new dojo.dnd.HtmlDropTarget("container'.$p.'", ["container0",';
for ($o =1 ;$o <= $num;$o++){
echo '"container'.$o.'"';
if ($o != $num){
echo ",";
}
}
echo ']); ';
}
echo chr(13);
?>
}
//增加到window.onload事件中
window.onload=function(){init();}
function bjsave() {
gr=""
<?php
$sql='select id from module';
$result=mssql_query($sql,$conn);
while($myrow=mssql_fetch_array($result))
echo 'if (mokuai'.$myrow['id'].'.parentElement.id !="container0") {'.chr(13).'gr=gr+'.$myrow['id'].'+"|"+ mokuai'.$myrow['id'].'.parentElement.id+ "$"'.chr(13).'}'.chr(13);
?>
form1.gr.value=gr;
form1.submit();
}
</script>
<div id="overDiv" STYLE="position:absolute; visibility:hide; z-index: 1;"></div>
<div id="container0">
<?php
$sql='select * from module where id not in (select mokuaiid from geren where gh ='.$_SESSION['gh'].')';
$result=mssql_query($sql,$conn);
while($myrow=mssql_fetch_array($result))
echo '<span class="divdrag" id="mokuai'.$myrow['id'].'" style="border:1px dotted #990033;height: 20px;width:100px;margin: 5px; " title="'.$myrow['mmark'].'">'.$myrow['mn'].'</span>';
?>
</div>
<table width="98%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="150" valign="top">
<?php
for ($p=1; $p<=$num;$p=$p+2){
echo '<div id="container'.$p.'" style="border:1px dotted #990033;height: 100px;margin: 10px; ">';
$sql='select mokuaiid from geren where biaogeid='.$p.' and gh ='.$_SESSION['gh'];
$result=mssql_query($sql,$conn);
while($myrow=mssql_fetch_array($result)){
$sql='select * from module where id='.$myrow['mokuaiid'];
$result1=mssql_query($sql,$conn);
while($myrow1=mssql_fetch_array($result1)){
echo '<span class="divdrag" id="mokuai'.$myrow1['id'].'" style="border:1px dotted #990033;height: 20px;width:100px;margin: 5px; " title="'.$myrow1['mmark'].'">'.$myrow1['mn'].'</span>';
}
}
echo '</div>';
}
?></td>
<td width="150" valign="top">
<?php
for ($p=2; $p<=$num;$p=$p+2){
echo '<div id="container'.$p.'" style="border:1px dotted #990033;height: 100px;margin: 10px; ">';
$sql='select mokuaiid from geren where biaogeid='.$p.' and gh ='.$_SESSION['gh'];
$result=mssql_query($sql,$conn);
while($myrow=mssql_fetch_array($result)){
$sql='select * from module where id='.$myrow['mokuaiid'];
$result1=mssql_query($sql,$conn);
while($myrow1=mssql_fetch_array($result1)){
echo '<span class="divdrag" id="mokuai'.$myrow1['id'].'" style="border:1px dotted #990033;height: 20px;width:100px;margin: 5px; " title="'.$myrow1['mmark'].'">'.$myrow1['mn'].'</span>';
}
}
echo '</div>';
}
?>
</td>
</tr>
</table>
<input type="button" name="Submit" value="保存布局" onclick="bjsave();" />
<form id="form1" name="form1" method="post" action="savegr.php">
<input name="gr" type="hidden" value="" />
</form>
复制代码 代码如下:
<?php
session_start();
if ($_SESSION['gh']==''){
header('location:login.php');
}
include("config.php");
$sql='delete from geren where gh='.$_SESSION['gh'];
mssql_query($sql);
$gr=str_replace("container","",$_POST['gr']);
//echo $gr;
$array = explode("$", $gr);
for ($i=0;$i<=count($array)-2;$i++){
$add=explode("|",$array[$i]);
$sql='insert into geren (mokuaiid,biaogeid,gh) values ("'.$add[0].'","'.$add
[1].'","'.$_SESSION['gh'].'")';
//echo $sql.'<br>';
mssql_query($sql);
}
header("location:view.php");
?>
dojo 这里下载 http://download.dojotoolkit.org/release-0.3.1/dojo-0.3.1-ajax.zip
DDR爱好者之家 Design By 杰米
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
DDR爱好者之家 Design By 杰米
暂无评论...
更新日志
2024年11月25日
2024年11月25日
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓WAV+CUE]
- 刘嘉亮《亮情歌2》[WAV+CUE][1G]
- 红馆40·谭咏麟《歌者恋歌浓情30年演唱会》3CD[低速原抓WAV+CUE][1.8G]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[320K/MP3][193.25MB]
- 【轻音乐】曼托凡尼乐团《精选辑》2CD.1998[FLAC+CUE整轨]
- 邝美云《心中有爱》1989年香港DMIJP版1MTO东芝首版[WAV+CUE]
- 群星《情叹-发烧女声DSD》天籁女声发烧碟[WAV+CUE]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[FLAC/分轨][748.03MB]
- 理想混蛋《Origin Sessions》[320K/MP3][37.47MB]
- 公馆青少年《我其实一点都不酷》[320K/MP3][78.78MB]
- 群星《情叹-发烧男声DSD》最值得珍藏的完美男声[WAV+CUE]
- 群星《国韵飘香·贵妃醉酒HQCD黑胶王》2CD[WAV]
- 卫兰《DAUGHTER》【低速原抓WAV+CUE】
- 公馆青少年《我其实一点都不酷》[FLAC/分轨][398.22MB]
- ZWEI《迟暮的花 (Explicit)》[320K/MP3][57.16MB]