<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>jQuery Input Floating Hint Box - Demo - Examples</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="keywords" content="jQuery InputHintBox" />
<meta name="description" content="jQuery InputHintBox" />
</head>
<body>
<script src="http://nicolae.namolovan.googlepages.com/jquery-1.2.3.min.js"></script>
<script src="http://nicolae.namolovan.googlepages.com/jquery.dimensions.min.js"></script>
<script src="http://nicolae.namolovan.googlepages.com/jquery.inputHintBox.js"></script>
<style>
body {
color:#000;
min-width: 600px;
font-family: arial,helvetica,clean,sans-serif;
font-size: 9pt;
line-height: 1.32em;
}
.textstyle {
font-size:100%;
font-family: Arial,Helvetica,sans-serif;
border-color: #A7A7A7 #CCCCCC #CCCCCC #CCCCCC;
border-style:solid;
border-width:1px;
color:#555555;
font-size:1em;
}
.alignToRight {
text-align:right;
vertical-align:top;
}
/* Some round fancies */
.tl, .tr, .bl, .br {
background: url(corners.gif);
width: 10px;
height: 10px;
font-size: 0;
}
.tl, .bl {
float: left;
}
.tr, .br {
float: right;
}
.shiny_box {
background: #0066FF;
color: #FFF;
width: 210px;
overflow: hidden;
}
.shiny_box p {
margin:10px;
}
.shiny_box .tl {
background-position: -340px 0px;
}
.shiny_box .tr {
background-position: -350px 0px;
}
.shiny_box .bl {
background-position: -340px 10px;
}
.shiny_box .br {
background-position: -350px 10px;
}
.shiny_box_body {
clear: both;
padding: 0 10px;
overflow: hidden;
}
* html .shiny_box_body {
height: 1%;
}
.simple_box {
width:200px;
padding:10px;
background-color:#D9E6F7;
border:3px solid green;
}
</style>
<br>
<h1 align="center">jQuery InputHintBox</h1>
<div style="margin-left:100px">
Click on some input element
<table cellpadding="4">
<tr>
<td class="alignToRight">
<label for="input_text_0">Username:</label>
</td>
<td>
<input type="text" id="input_text_0" class="textstyle titleHintBox" title="Username, <b>you <br>can use html</b>Username, <b>you <br>can use html</b>Username, <b>you <br>can use html</b>Username, <b>you <br>can use html</b>Username, <b>you <br>can use html</b>">
</td>
</tr>
<tr>
<td class="alignToRight">
<label for="input_text_1">Password:</label>
</td>
<td>
<input type="text" id="input_text_1" class="textstyle titleHintBox" title="Password, make it longer">
</td>
</tr>
<tr>
<td class="alignToRight">
<label for="input_text_2">Other:</label>
</td>
<td>
<input type="text" id="input_text_2" class="textstyle titleHintBox2" title="This a simple box with a class as style Other bla bla bla Other bla bla blaOther bla bla blaOther bla bla blaOther bla bla blaOther bla bla bla">
</td>
</tr>
<tr>
<td class="alignToRight">
<label for="input_text_3">Other Same1:</label>
</td>
<td>
<input type="text" id="input_text_3" class="textstyle titleHintBox3">
</td>
</tr>
<tr>
<td class="alignToRight">
<label for="input_text_4">Other Same2:</label>
</td>
<td>
<input type="text" id="input_text_4" class="textstyle titleHintBox3">
</td>
</tr>
<tr>
<td class="alignToRight">
<label for="input_text_5">Other Same3:</label>
</td>
<td>
<input type="text" id="input_text_5" class="textstyle titleHintBox3">
</td>
</tr>
<tr>
<td class="alignToRight">
<label for="select_0">Select box:</label>
</td>
<td>
<select id="select_0" class="textstyle titleHintBox" title="Select hint..">
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
<option>Option 4</option>
</select>
</td>
</tr>
<tr>
<td class="alignToRight">
</td>
<td>
<label for="checkbox">
<input type="checkbox" id="checkbox" class="titleHintBox" title="Checkbox help"> Checkbox
</label>
</td>
</tr>
</table>
<div>
Js used:<br><br>
<!-- Gen with http://www.chami.com/colorizer/ -->
<pre>
$<FONT COLOR=BLUE SIZE=+1><B>(</B></FONT><FONT COLOR=PURPLE>'.titleHintBox'</FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>.</B></FONT>inputHintBox<FONT COLOR=BLUE SIZE=+1><B>(</B></FONT><FONT COLOR=BLUE SIZE=+1><B>{</B></FONT>div<FONT COLOR=BLUE SIZE=+1>:</FONT>$<FONT COLOR=BLUE SIZE=+1><B>(</B></FONT><FONT COLOR=PURPLE>'#shiny_box'</FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>,</B></FONT>div_sub<FONT COLOR=BLUE SIZE=+1>:</FONT><FONT COLOR=PURPLE>'.shiny_box_body'</FONT><FONT COLOR=BLUE SIZE=+1><B>,</B></FONT>source<FONT COLOR=BLUE SIZE=+1>:</FONT><FONT COLOR=PURPLE>'attr'</FONT><FONT COLOR=BLUE SIZE=+1><B>,</B></FONT>attr<FONT COLOR=BLUE SIZE=+1>:</FONT><FONT COLOR=PURPLE>'title'</FONT><FONT COLOR=BLUE SIZE=+1><B>,</B></FONT>incrementLeft<FONT COLOR=BLUE SIZE=+1>:</FONT><FONT COLOR=BROWN>5</FONT><FONT COLOR=BLUE SIZE=+1><B>}</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>
$<FONT COLOR=BLUE SIZE=+1><B>(</B></FONT><FONT COLOR=PURPLE>'.titleHintBox2'</FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>.</B></FONT>inputHintBox<FONT COLOR=BLUE SIZE=+1><B>(</B></FONT><FONT COLOR=BLUE SIZE=+1><B>{</B></FONT>className<FONT COLOR=BLUE SIZE=+1>:</FONT><FONT COLOR=PURPLE>'simple_box'</FONT><FONT COLOR=BLUE SIZE=+1><B>,</B></FONT>source<FONT COLOR=BLUE SIZE=+1>:</FONT><FONT COLOR=PURPLE>'attr'</FONT><FONT COLOR=BLUE SIZE=+1><B>,</B></FONT>attr<FONT COLOR=BLUE SIZE=+1>:</FONT><FONT COLOR=PURPLE>'title'</FONT><FONT COLOR=BLUE SIZE=+1><B>,</B></FONT>incrementLeft<FONT COLOR=BLUE SIZE=+1>:</FONT><FONT COLOR=BROWN>5</FONT><FONT COLOR=BLUE SIZE=+1><B>}</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>
$<FONT COLOR=BLUE SIZE=+1><B>(</B></FONT><FONT COLOR=PURPLE>'.titleHintBox3'</FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>.</B></FONT>inputHintBox<FONT COLOR=BLUE SIZE=+1><B>(</B></FONT><FONT COLOR=BLUE SIZE=+1><B>{</B></FONT>className<FONT COLOR=BLUE SIZE=+1>:</FONT><FONT COLOR=PURPLE>'simple_box'</FONT><FONT COLOR=BLUE SIZE=+1><B>,</B></FONT>html<FONT COLOR=BLUE SIZE=+1>:</FONT><FONT COLOR=PURPLE>'Same text for more inputs'</FONT><FONT COLOR=BLUE SIZE=+1><B>,</B></FONT>incrementLeft<FONT COLOR=BLUE SIZE=+1>:</FONT><FONT COLOR=BROWN>5</FONT><FONT COLOR=BLUE SIZE=+1><B>}</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>;</B></FONT></pre>






</div>
</div>
<div id="shiny_box" class="shiny_box" style="display:none;">
<span class="tl"></span><span class="tr"></span>
<div class="shiny_box_body"></div>
<span class="bl"></span><span class="br"></span>
</div>


<script>
$().ready(function(){
$('.titleHintBox').inputHintBox({div:$('#shiny_box'),div_sub:'.shiny_box_body',source:'attr',attr:'title',incrementLeft:5});
$('.titleHintBox2').inputHintBox({className:'simple_box',source:'attr',attr:'title',incrementLeft:5});
$('.titleHintBox3').inputHintBox({className:'simple_box',html:'Same text for more inputs',incrementLeft:5});
});
</script>
</body>
</html>
如对本文有疑问,请提交到交流论坛,广大热心网友会为你解答!! 点击进入论坛