English 中文(简体)
如何使用javascript获得jsf h:output 案文价值?
原标题:how to use javascript to get jsf h:outputText value?

我有一个县可以采取行动,打我的班子。 我的圈子和浮雕活动都要求用js方法提醒这一价值。 我只想通过使用javascript,从背靠背的豆类中获取我雕刻的价值。

我有隐藏的产出,其价值来自支持信条:

h:outputText id="myOutput" rendered="false" value="#{myBackingBean.myString}" 

然后,我需要警惕由纽瓦特引发的javascript fxn的这种价值:

function myFunction() {

var outPut= document.getElementById("myForm:myOutput").value;

...

}

but i got Object required error. How can i fix this? thanks in advance.

最佳回答

你们可以肯定的是,光电灯的提供(放电=“false”)不能在OM中添加。 如果无法做到这一点,它就能够进入。 如果你需要隐蔽,则使用:inputHidden。

然后,确保作为或作为集装箱的超文本标签成为“米Form:myOutput”。

此外,将javascript accesor用于输入标签,因此使用超文本。

问题回答

你们不一定总是需要一个隐蔽的场所来获取英国财产。 你可以做如下工作。

<h:commandButton value="Show" onclick="alert( #{myBackingBean.myString} );"/>

但是,如果你在点击 but子时想要改变myString的价值,那么你想展示新的价值:<a4j:commandButton/> 及其Complete属性。

<a4j:commandButton value="Change" action="#{myBackingBean.changeString()}" oncomplete="alert( #{myBackingBean.myString} );" />




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

热门标签