1. 程式人生 > >AJAX 無重新整理 文字框提示條,用層來提示[原創]

AJAX 無重新整理 文字框提示條,用層來提示[原創]

<%@ Page language="c#" Codebehind="WebForm2.aspx.cs" AutoEventWireup="false" Inherits="ajax10.WebForm2"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
    
<HEAD>
        
<title>WebForm2</title>
        
<meta content="Microsoft Visual Studio .NET 7.1"
 name="GENERATOR">
        
<meta content="C#" name="CODE_LANGUAGE">
        
<meta content="JavaScript" name="vs_defaultClientScript">
        
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
        
<script language="javascript">
        var index,which;
        function Text1_onkeyup(str)
        
{
        
        var s
=document.getElementById(str).getBoundingClientRect();//得控制元件絕對位置   ;getElementById(str)查詢物件
        document.getElementById("div1").style.left=s.left;
        document.getElementById(
"div1").style.top=s.bottom;
        document.getElementById(
"div1").style.width=document.getElementById(str).style.width;
        
        
switch (window.event.keyCode)
        
{
        
            
case13//回車
                document.getElementById("div1").style.visibility="hidden";
                
break;
            
case40://向右箭頭
case39//向下箭頭
if (index < document.getElementById("div1").childNodes.length) 
                
{
                    index
=index+1;
                }

                
for (i=1;i<=document.getElementById("div1").childNodes.length;i++)
                
{
                    
if (i==index)
                    
{
                        document.getElementById(str).value
=document.getElementById("div1").childNodes[index-1].innerText;//取值  ;   innerHTML:取程式碼
                        document.getElementById("div1").childNodes[index-1].style.backgroundColor="lightblue";
                    }

                    
else
                    
{
                        document.getElementById(
"div1").childNodes[i-1].style.backgroundColor="white";//背景變白
                        
                    }

                }

                
break;
            
case38://向左箭頭
case37://向上箭頭 
if (index>1
                
{
                    index
=index-1;
                }

                
for (i=1;i<=document.getElementById("div1").childNodes.length;i++)
                
{
                    
if (i==index)
                    
{
                        document.getElementById(str).value
=document.getElementById("div1").childNodes[index-1].innerText;//.substr(1);
                        document.getElementById("div1").childNodes[index-1].style.backgroundColor="lightblue";
                    }

                    
else
                    
{
                        document.getElementById(
"div1").childNodes[i-1].style.backgroundColor="white";
                    }

                }

                
break;
            
default:
                index
=0;
                which
=str;
                
if(str=="TextBox1")
                
{
                    stuInfoView.getMatchedStuId(document.getElementById(str).value,getGG_callBack);
                }

                
if(str=="TextBox2")
                
{
                    stuInfoView.getB_KH_name(document.getElementById(str).value,getGG_callBack);
                }

                
if(str=="TextBox3")
                
{
                    stuInfoView.getC_CP2_name(document.getElementById(str).value,getGG_callBack);
                }

        }

    }

    String.prototype.Trim 
= function() 
        

            
returnthis.replace(/(^s*)|(s*$)/g, ""); 
        }
 
    function getGG_callBack(response)
    
{
        
if(response.value.length !=0)
        
{                      
      var ds 
= response.value;
                     
           var s;
           s
="";
            
for(var i=0;i<response.value.length;++i)
        
{
       var sd;
             
if(which=="TextBox1")
             
{
                s
=+"<div style="" class="gotTitle" onmouseover="javascript:this.style.backgroundColor='lightblue'" onclick="return gotTitle_onclick()">"+ response.value[i].Trim() +"</div>";
             }

             
if(which=="TextBox2")
             
{
                s
=+"<div style="" class="gotTitle" onmouseover="javascript:this.style.backgroundColor='lightblue'" onmouseout="javascript:this.style.backgroundColor='white'" onclick="return gotTitle_onclick()">"+ response.value[i].Trim() +"</div>";
             }

              
if(which=="TextBox3")
             
{
                s
=+"<div style="" class="gotTitle" onmouseover="javascript:this.style.backgroundColor='lightblue'" onclick="return gotTitle_onclick()">"+ response.value[i].Trim() +"</div>";
             }

        }
 
        document.getElementById(
"div1").innerHTML=s;
            document.getElementById(
"div1").style.visibility="visible";               
           
         }

      
return
     }

    function gotTitle_onclick()
    
{
        
if (window.event.srcElement.className="gotTitle")

相關推薦

AJAX 重新整理 文字提示,提示[原創]

<%@ Page language="c#" Codebehind="WebForm2.aspx.cs" AutoEventWireup="false" Inherits="ajax10.WebForm2"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4

Tp框架裡進行ajax重新整理查詢

這個ajax學的時候感覺很簡單,就沒有認真好好理解。到今天要用的時候才麻煩百出....其中一個尤為重要的問題是在拼接時出現的。還好得到了大佬的提點,才發現是自己的思路有問題(話不多說,把今天的總結一下,以後不要在出錯了......) 這是最後的效果圖    

獲取網頁文字的值. pageoffice 生成word 文件

需求: 在網頁的文字框裡面填一段文字,然後就會匯出一個word文件,文件中這段字是紅色,小三,宋體,等等 第一步: 在卓正官網下載完整的試用程式包 http://www.zhuozhengsoft.com/dowm/ 第二步: 複製jar包到lib下面,複製web.xml檔

解決ajax區域性重新整理後,滾動位置變化的問題

問題描述:網頁底部實現了點贊和收藏功能,給長篇文點贊並更新點 贊數量之後,滾動條回到網頁頂部。 修改之前: <a href="#" th:onclick="'javascript:updateNum('+${article.id}+')'" > <i clas

Ajax 重新整理登陸

截圖: 檢視.cshtml: @{     ViewBag.Title = "LoginView"; } <!DOCTYPE html> <html> <head>     <me

淺談TP5的ajax重新整理分頁

簡單說一下如何進行TP5的ajax無重新整理分頁吧,這個功能實現的方法有千百種,或許我提供的這一種並不是最好的,但確實是很實用的。 以下的例子會使用TP5自帶的分頁類來實現,無任何修改。 首先來一段後臺查詢資料的程式碼,查詢出相關的資料     $list = Load

利用ajax重新整理驗證註冊資訊

其大概思路如下: 一.把註冊的html頁面做好(html+css) 1.不需要form表單,直接用div包著 2.需要四個標籤來顯示正確、錯誤的資訊顯示 3.不用submit提交按鈕,直接用button 如圖: 二.把ajax做成一個函式,通過傳

ajax重新整理下載檔案 虛擬form

<a href="javascript:downloadFile('${msSend.attachmentAddress }','${fileName }')">${fileName }</a><br> function downlo

JS驗證文字字數並做限制和提示

效果如圖;解決輸入時拼音長度也算字串長度的問題。 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewpor

laravel ajax重新整理替換圖片 並改變資料表狀態值

@section('js') <script type="text/javascript"> function change(ele){ var img = $(ele).children();//得到子節點 var my

ThinkPHP+JQuery實現ajax重新整理登入驗證(詳解+相關問題)

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> &

關於Ajax重新整理分頁技術的一些研究 c#

小弟新手,求大神有更好的解決方案,指教下~ 以前做專案,用過GridView的重新整理分頁,也用過EasyUI的封裝好的分頁技術,最近在老專案的基礎上加新功能,迫於需求,自己沒事琢磨了個Ajax無重新整理分頁技術, 也在百度看了下, 寫的都不是很系統,在這裡寫個系統的,簡單的,方便大家研究下。 系統支

Ajax重新整理使用者登入

 程式碼:  login.jsp <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLI

Laravel 5.1之Ajax重新整理分頁

ajax無重新整理分頁的優點: 1、區域性重新整理 減輕壓力 2、美觀 提高使用者體驗 php程式碼: /* @Laravel框架 @Ajax無重新整理分頁(簡單7步驟) */ public fu

VBA-批量刪除文字內容(類實現)

1.首先,我們建立一個類,類裡面包含控制元件個數,並且有相應的方法,具體程式碼如下Option ExplicitPrivate arr() As MSForms.TextBoxPrivate count As Integer '控制元件個數'獲得文字框個數,將文字框存入陣列S

jquery.page.js實現ajax重新整理分頁

http://blog.csdn.net/dengboblog/article/details/52699332  寫程式碼參考了這位大神的部落格。下面貼上我的程式碼。 首先是要把引入的分頁js和css新增進來。這個程式碼自己百度吧。 $.ajax({ type

ajaxfileupload.js外掛結合一般處理檔案實現Ajax重新整理上傳

先上幾張圖更直觀展示一下要實現的功能,本功能主要通過Jquery ajaxfileupload.js外掛結合ajaxUpFile.ashx一般應用程式處理檔案實現Ajax無重新整理上傳功能,結合NPOI2.0實現資料讀取。這個功能在實際工作種經常用到,希望能

SpringMVC結合ajaxfileupload.js實現ajax重新整理檔案上傳

一、spring mvc配置 1、web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xm

jquery ajax 重新整理上傳檔案到servlet

刪除檔案的表單要加入如下enctype屬性: <form id="upload" enctype="multipart/form-data"><!--//由於使用ajax上傳,不用加action和method屬性--> 要實現無重新整理上傳檔案首

ajax重新整理上傳圖片,基於springMVC

html程式碼(圖片上傳Fform表單裡的target屬性的值frameFile,是form之後的iframe的name值, 這樣的寫法是讓當前的form表單在提交表單內容的時候轉交給iframe中進行頁面中表單處理, 並且不會產生當前頁面跳轉!): <form id