当鼠标放在相应文字的上面,就弹出关于这个文字的说明解决思路
当鼠标放在相应文字的上面,就弹出关于这个文字的说明
是用Java做一个代码编辑器,原理是什么?
------解决方案--------------------
原理? 不懂。。。。 帮你顶一个。 我只知道用颜色控制编辑器里的那些关键字
------解决方案--------------------
这是ToolTip,也就是悬浮工具条,用来提示信息的。
开发UI的时候用的很多,当然你也可以自己实现
用Java做编辑器,不知道你想做那种,类似eclipse的那种么?
------解决方案--------------------
用类和js结合可以根据条件做个辅助类
类里面的方法
public static void AlertWindowScript(Page page, string title, string content, string width, string height)
{
page.ClientScript.RegisterStartupScript(page.GetType(), "dialog", "dialog('" + title + "','" + content + "','" + width + "','" + height + "');", true);
}
这是js代码
var dialogFirst=true; //弹出层显示开关
function dialog(title,content,width,height,cssName){
if(dialogFirst==true){ //生成背景弹出层
var temp_float=new String;
temp_float="<div id=\"floatBoxBg\" style=\"height:"+$(document).height()+"px;filter:alpha(opacity=0);opacity:0;\"><iframe id=\"DivShim\" scrolling=\"no\"> </iframe> </div>";
temp_float+="<div id=\"floatBox\" class=\"floatBox\">";
temp_float+="<div class=\"title\"><h4></h4><span><img src=\"http://www.yoyard.com/Images/ad_close.png\" width=\"64\" height=\"21\" /></span></div>";
temp_float+="<div id=\"tccbg\">";
temp_float+="<div class=\"content\"></div>";
temp_float+="</div>";
temp_float+="</div>";
$("body").prepend(temp_float); //将背景弹出层添加到对应页面
dialogFirst=false;
}
$("#floatBox .title span").click(function(){
$("#floatBoxBg").animate({opacity:"0"},"normal",function(){$(this).hide();});
//$("#floatBox").animate({top:($(document).scrollTop()-(height=="auto"?300:parseInt(height)))+"px"},"normal",function(){$(this).hide();});
$("#floatBox").hide();
//history.go(-1);
});
$("#floatBox .title h4").html(title);
contentType=content.substring(0,content.indexOf(":")); //内容以:区分
content=content.substring(content.indexOf(":")+1,content.length);
switch(contentType){
case "url":
var content_array=content.split("?");
$("#floatBox .content").ajaxStart(function(){
$(this).html("loading...");
});
$.ajax({
type:"GET",
url:content_array[0],
cache: false,
data:content_array[1],
error:function(){
$("#floatBox .content").html("error...");
},
success:function(html){
$("#floatBox .content").html(html);
}
});
break;
case "text":
$("#floatBox .content").html(content);
break;
case "id":
$("#floatBox .content").html($("#"+content+"").html());
break;
case "iframe":
$("#floatBox .content").html("<iframe src=\""+content+"\" width=\"100%\" height=\""+(parseInt(height)-70)+"px"+"\" scrolling=\"auto\" frameborder=\"0\" marginheight=\"0\" marginwidth=\"0\"></iframe>");
是用Java做一个代码编辑器,原理是什么?
------解决方案--------------------
原理? 不懂。。。。 帮你顶一个。 我只知道用颜色控制编辑器里的那些关键字
------解决方案--------------------
这是ToolTip,也就是悬浮工具条,用来提示信息的。
开发UI的时候用的很多,当然你也可以自己实现
用Java做编辑器,不知道你想做那种,类似eclipse的那种么?
------解决方案--------------------
用类和js结合可以根据条件做个辅助类
类里面的方法
public static void AlertWindowScript(Page page, string title, string content, string width, string height)
{
page.ClientScript.RegisterStartupScript(page.GetType(), "dialog", "dialog('" + title + "','" + content + "','" + width + "','" + height + "');", true);
}
这是js代码
var dialogFirst=true; //弹出层显示开关
function dialog(title,content,width,height,cssName){
if(dialogFirst==true){ //生成背景弹出层
var temp_float=new String;
temp_float="<div id=\"floatBoxBg\" style=\"height:"+$(document).height()+"px;filter:alpha(opacity=0);opacity:0;\"><iframe id=\"DivShim\" scrolling=\"no\"> </iframe> </div>";
temp_float+="<div id=\"floatBox\" class=\"floatBox\">";
temp_float+="<div class=\"title\"><h4></h4><span><img src=\"http://www.yoyard.com/Images/ad_close.png\" width=\"64\" height=\"21\" /></span></div>";
temp_float+="<div id=\"tccbg\">";
temp_float+="<div class=\"content\"></div>";
temp_float+="</div>";
temp_float+="</div>";
$("body").prepend(temp_float); //将背景弹出层添加到对应页面
dialogFirst=false;
}
$("#floatBox .title span").click(function(){
$("#floatBoxBg").animate({opacity:"0"},"normal",function(){$(this).hide();});
//$("#floatBox").animate({top:($(document).scrollTop()-(height=="auto"?300:parseInt(height)))+"px"},"normal",function(){$(this).hide();});
$("#floatBox").hide();
//history.go(-1);
});
$("#floatBox .title h4").html(title);
contentType=content.substring(0,content.indexOf(":")); //内容以:区分
content=content.substring(content.indexOf(":")+1,content.length);
switch(contentType){
case "url":
var content_array=content.split("?");
$("#floatBox .content").ajaxStart(function(){
$(this).html("loading...");
});
$.ajax({
type:"GET",
url:content_array[0],
cache: false,
data:content_array[1],
error:function(){
$("#floatBox .content").html("error...");
},
success:function(html){
$("#floatBox .content").html(html);
}
});
break;
case "text":
$("#floatBox .content").html(content);
break;
case "id":
$("#floatBox .content").html($("#"+content+"").html());
break;
case "iframe":
$("#floatBox .content").html("<iframe src=\""+content+"\" width=\"100%\" height=\""+(parseInt(height)-70)+"px"+"\" scrolling=\"auto\" frameborder=\"0\" marginheight=\"0\" marginwidth=\"0\"></iframe>");