English 中文(简体)
摘录我的 j
原标题:Finishing my jQuery typing feature

现在,我有某些法典,产生<代码>和>;li>,其中含有高和宽度,并具有某种背景形象。 当用户使用钥匙时,配对板类在制作的<代码><li>上形成某种特性。 我有两个积极的问题。

  1. 在空间区分类时,我想到<代码><li>之间的空间。 为此,我创建了一个空白的<代码><li>要素,包含“有一类“ejotyBlank”。 但出于某种原因,这不会给我工作!

  2. 当用户点击背空间时,应当删除最后一个<代码><li>。 我甚至不知道从哪里开始处理这个问题。

现在,我通过创建一个阵列,并在每一次关键人物被施压时,使用一个排气机生成所有<条码>和>;li>。

You can visit the page and its action on this page: ImASpy.com/Ejoty Click inside of Title: and start typing letters.

我确信,这并非全部适用,特别是特别安全局,但这里也是我的法典。

非常感谢帮助我完成这项工作的人。

www.un.org/Depts/DGACM/index_spanish.htm 这里是我的 j:。

$(document).ready(function() {

var maxWidth = 0;
var titleArray = new Array;
var nameArray = new Array;
var i = 0;
var letterWidth;

$( #ejotyTitleInput ).keypress(function(e)
{
    var letterValue = String.fromCharCode(e.which);

if (e.which == 8) {
                e.preventDefault();
                alert( back space );
            }   
    if(e.which==32){
        var newNode = document.createElement("li"); 
        $(newNode).addClass("ejotyBlank");
        newNode.appendChild(document.createTextNode("&nbsp;&nbsp;"));
        titleArray[i] = newNode;
    }


    if (letterValue.match(/[a-zA-Z.]/))
    letterValue = letterValue.toUpperCase();
    letterValue = "ejoty" + letterValue;


    var newNode = document.createElement("li"); 
    $(newNode).addClass(letterValue);

    nameArray[i] = letterValue;
    titleArray[i] = newNode;
    i++;


    maxWidth = 0;
    letterWidth = 0;
    for(var x = 0;x<=titleArray.length;++x){
        var currentLI = titleArray[x];
        $("ul#ejotyTitle").append(currentLI);
        letterWidth += $("." + nameArray[x]).width() + 3;
        var currentLetterWidth = $("." + nameArray[x]).width();
        maxWidth = maxWidth + currentLetterWidth;
        $("ul#ejotyTitle").css("width", letterWidth)
    }
});

});

www.un.org/Depts/DGACM/index_spanish.htm 这里是我的超文本代码:。

  <footer id="page1">
    <h2>Now you try!</h2>
    <form id="ejotyCreator">
        <table>
        <tr>
        <td>Title:</td>
        <td><input type="text" id="ejotyTitleInput" name="title" /></td>
        </tr>
        <tr>
        <td>Text:</td>
        <td><textarea name="ejotyText" cols="20" rows="2" id="ejotyText"></textarea></td>
        </tr>
        <tr>
        <td>Signed:</td>
        <td><input type="text" id="ejotySig" name="title"/></td>
        </tr>

        </table>
    </form>
  </footer><!-- end page1 footer -->


 <section id="rightPage" class="clearfix">

              <ul class="ejotyWriting clearfix">
                  <li class="ejotyT"></li>
                  <li class="ejotyH"></li>
                  <li class="ejotyI"></li>
                  <li class="ejotyS"></li>
                  <li>&nbsp;</li>
                  <li class="ejotyI"></li>
                  <li class="ejotyS"></li>
                  <li>&nbsp;</li>
                  <li class="ejotyE"></li>
                  <li class="ejotyJ"></li>
                  <li class="ejotyO"></li>
                  <li class="ejotyT"></li>
                  <li class="ejotyY"></li>
                  <li class="ejotyOther">-</li>
                  <li class="ejotyZ"></li>
                  <li>...</li>
              </ul>
                  <br />
                  <br />
              <div id="centerTitle">
              <ul class="ejotyWriting clearfix" id="ejotyTitle">
              </ul><!-- end title -->
              </div><!--end centerTitle -->
                   <br />
              <ul class="ejotyWriting clearfix" id="ejotyUserContent" >    
              </ul><!-- end ejotyContent -->
                  <br />

              <ul class="ejotyWriting clearfix" id="ejotySigniature"> 
              </ul><!-- end ejotyContent -->


      </section><!-- end rightPage -->

www.un.org/Depts/DGACM/index_spanish.htm 我的社会保障局:

    /************* EJOTYZ CONTENT *************/


section, footer {
    display: block;
}


table, tr, td {
    margin: 0;
    padding: 0;
}
form {
    padding: 0;
    margin: 0;
}
td.subtractMargin {
    margin-top: 15px;
}

h2 {
    color: #333;
    margin: 0 0 0 0px;
    padding: 0;
    text-decoration: underline;
}

textarea {
    resize: none;
    margin: 0 0 -6px 10px;
    padding: 5px;
}



input {
    margin: 0 0 0 10px;
    padding: 5px;
    color: #000;
}

footer#page1 {
    width: 260px;
    height: 80px;
    position: absolute;
    top: 350px;
    left: 45px; 
}

section#rightPage {
    width: 320px;
    height: 390px;
    position: absolute;
    top: 15px;
    left: 355px;
    overflow: auto; 
}


hr {
    border-top-width: 2px;
    border-top-style: dotted;
    border-right-style: none;
    border-bottom-style: none;
    border-left-style: none;
    border-top-color: #333;
    border-right-color: #333;
    border-bottom-color: #333;
    border-left-color: #333;
    width: 275px;
    margin: -1px 0 15px 10px;
}
footer#page2 {
    width: 270px;
    height: 80px;
    position: absolute;
    top: 405px;
    left: 395px;    
}

ul#ejoty {
    padding: 0;
    margin: 0 0 0 35px;
}

ul#ejoty li {
    list-style: none;
    display: block;
    float: left;
    color: #000;
    margin-right: 2px;
}

ul.ejotyWriting {
    padding: 0;
    margin: 0 0 0 5px;  
}

ul.ejotyWriting li {
    list-style: none;
    display: block;
    float: left;
    color: #000;
    margin-right: 2px;  
}

h1.bookTitle {
    color: #333;
    margin-left: 15px;
}

ul#ejotyUserContent {
 background: #3F9;  
 width: auto;
}


div#centerTitle {
 padding: 0px 5px 5px 5px;
 width: 300px;
 text-align: center;
 margin: 0 auto;
}

ul#ejotyTitle {
max-width: 300px;
margin: 0 auto; 
}




/************* EJOTYZ LETTERS *************/

.ejotyBlank {
height:12px;
width:43px;
margin-top: 5px;
}

.ejotyOther {
height:12px;
}


.ejotyB{
height:12px;
width:34px;
margin-top: 5px;
background:url(images/ejoty.png) -50px 1px no-repeat;
}

.ejotyC{
height:12px;
width:27px;
margin-top: 5px;
background:url(images/ejoty.png) -90px 1px no-repeat;
}

.ejotyD{
height:12px;
width:19px;
margin-top: 5px;
background:url(images/ejoty.png) -123px 1px no-repeat;
}

.ejotyE{
height:12px;
width:10px;
margin-top: 5px;
background:url(images/ejoty.png) -149px 1px no-repeat;
}

.ejotyF{
height:12px;
width:43px;
margin-top: 5px;
background:url(images/ejoty.png) -1px -20px no-repeat;
}

.ejotyG{
height:12px;
width:35px;
margin-top: 5px;
background:url(images/ejoty.png) -49px -20px no-repeat;
}

.ejotyH{
height:12px;
width:27px;
margin-top: 5px;
background:url(images/ejoty.png) -90px -20px no-repeat;
}

.ejotyI{
height:12px;
width:19px;
margin-top: 5px;
background:url(images/ejoty.png) -124px -20px no-repeat;
}

.ejotyJ{
height:12px;
width:14px;
margin-top: 5px;
background:url(images/ejoty.png) -150px -20px no-repeat;
}

.ejotyK{
height:12px;
width:45px;
margin-top: 5px;
background:url(images/ejoty.png) -1px -44px no-repeat;
}

.ejotyL{
height:12px;
width:36px;
margin-top: 5px;
background:url(images/ejoty.png) -50px -44px no-repeat;
}

.ejotyM{
height:12px;
width:28px;
margin-top: 5px;
background:url(images/ejoty.png) -92px -44px no-repeat;
}

.ejotyN{
height:12px;
width:20px;
margin-top: 5px;
background:url(images/ejoty.png) -125px -44px no-repeat;
}

.ejotyO{
height:12px;
width:16px;
margin-top: 5px;
background:url(images/ejoty.png) -150px -44px no-repeat;
}

.ejotyP{
height:12px;
width:44px;
margin-top: 5px;
background:url(images/ejoty.png) -1px -66px no-repeat;
}

.ejotyQ{
height:12px;
width:36px;
margin-top: 5px;
background:url(images/ejoty.png) -49px -66px no-repeat;
}

.ejotyR{
height:12px;
width:28px;
margin-top: 5px;
background:url(images/ejoty.png) -92px -66px no-repeat;
}

.ejotyS{
height:12px;
width:20px;
margin-top: 5px;
background:url(images/ejoty.png) -125px -66px no-repeat;
}

.ejotyT{
height:12px;
width:16px;
margin-top: 5px;
background:url(images/ejoty.png) -151px -66px no-repeat;
}

.ejotyU{
height:12px;
width:44px;
margin-top: 5px;
background:url(images/ejoty.png) -1px -88px no-repeat;
}

.ejotyV{
height:12px;
width:36px;
margin-top: 5px;
background:url(images/ejoty.png) -49px -88px no-repeat;
}

.ejotyW{
height:12px;
width:28px;
margin-top: 5px;
background:url(images/ejoty.png) -92px -88px no-repeat;
}

.ejotyX{
height:12px;
width:20px;
margin-top: 5px;
background:url(images/ejoty.png) -124px -88px no-repeat;
}

.ejotyY{
height:12px;
width:16px;
margin-top: 5px;
background:url(images/ejoty.png) -151px -88px no-repeat;
}

.ejotyZ{
height:12px;
width:16px;
margin-top: 5px;
background:url(images/ejoty.png) 0px -109px no-repeat;
}

.ejotyA{
height:12px;
width:43px;
margin-top: 5px;
background:url(images/ejoty.png) -1px 1px no-repeat;
}
最佳回答

奥凯再次开斋。 我做了一些细致的工作,通过你的法典,我发现了真正的问题。 你们不会忘记“ejotyBlank”类对你的新利要素适用,因为根据ejotyz.html第41条,你正在冲销你确定的“新诺德”价值。 将第40-48条改为:

if (letterValue.match(/[a-zA-Z.]/))
{
    letterValue = letterValue.toUpperCase();
    letterValue = "ejoty" + letterValue;


    var newNode = document.createElement("li"); 
    $(newNode).addClass(letterValue);

}

Regarding your backspace problem, I think you re going to have to go about it a different way. The problem with your current ( initial starting ) approach is that you are basically assuming that the backspace is entered at the end of the string. That may not be a valid assumption. In that case, you can t just drop the last "character" - instead you have to rebuild the whole string. Also, keypress doesn t get triggered when you hit backspace, from what I can tell. So I would change it to keyup instead. Your keyup function should replace the whole UI section with a new list rebuilt from the current text. If you need help writing a function to do that, let me know.

http://jsfiddle.net/LcbQn/3/“rel=“nofollow”http://jsfiddle.net/LcbQn/3/。

(文件) 页: 1

(职能) 页: 1

var fullString = $(this).val();
var maxWidth = 0;
var titleArray = new Array;
var nameArray = new Array;
var i = 0;
var letterWidth;

$("ul#ejotyTitle").empty();
for (var k=0;k<fullString.length;k++)
{
    var letterValue = fullString.substr(k,1);

    if(letterValue ==    ){
        var newNode = document.createElement("li"); 
        $(newNode).addClass("ejotyBlank").html("&nbsp;&nbsp;");
        titleArray[i] = newNode;
        nameArray[i] = "ejotyBlank";
    } else if (letterValue.match(/[a-zA-Z.]/))
    {
        letterValue = letterValue.toUpperCase();
        letterValue = "ejoty" + letterValue;


        var newNode = document.createElement("li"); 
        $(newNode).addClass(letterValue);
        nameArray[i] = letterValue;
        titleArray[i] = newNode;
    }
    i++;


    maxWidth = 0;
    letterWidth = 0;
    for(var x = 0;x<=titleArray.length;++x){
        var currentLI = titleArray[x];
        $("ul#ejotyTitle").append(currentLI);
        letterWidth += $("." + nameArray[x]).width() + 3;
        var currentLetterWidth = $("." + nameArray[x]).width();
        maxWidth = maxWidth + currentLetterWidth;
        $("ul#ejotyTitle").css("width", letterWidth)
    }


} iii

iii

问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签