English 中文(简体)
A. 需要为印瓦特的男性创造动态案文
原标题:Need to create dynamic text for menus with Javascript

我需要将动态的文本价值分配给能够放置在一米站点工作的某些内容,因为在某个时候需要稍后地方化。

我正希望在下文中提出他们的名单。

document.getElementsById( title ).innerHTML="Title1 Text";
document.getElementsById( title2 ).innerHTML="Title2 Text";

但当然,我想有<条码><<><>>>>>,<条码><2> divs,由于<条码>而赢得t工作。 是否有任何其他建议或解决办法?

问题回答

你们总是能够使用课堂而不是国际发展学。

<p class="introText">Title1 Text</p>
<p class="closingText">Title2 Text</p>

你们不仅不会影响你们的所有人,而且如果想把他们当作目标,就能够给他们增加一个身份证。

<p class="introText" id="topIntro">Title1 Text</p>
<p class="closingText">Title2 Text</p>
<p class="introText">Title1 Text (again)</p>

你们想要使用课堂而不是id。 但是,若不使用像JQuery这样的东西,那么 Java本不会因疏忽而发挥作用。

document.getElementsByClass = function(class){
   var itemsfound = new Array;
   var elements = document.getElementsByTagName( * );
   for(var i=0;i<elements.length;i++){
      if(elements[i].className == class){
         itemsfound.push(elements[i]);
      }
   }
   return itemsfound;
}

this will return an array of elements with the specified class. then you can use the following code as needed.

document.getElementsByClass( class ); // gives an array of elements of given class
document.getElementsByClass( class )[0]; // selects first element in array with given class

但是,如果你要使用JQuery的话,那就很简单:

$( .title ).html("Title 1 Text");
$( .title2 ).html("Title 2 Text");

希望以某种方式帮助。 che





相关问题
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.

热门标签