我在其中一个html页面中有以下代码段:
<div class="inputboximage">
<div class="value2">
<input name='address1' value='Somewhere' type="text" size="26" maxlength="40" />
<br />
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我的问题是,当我点击address1文本字段时,我需要更改inputboximage背景,并在失去焦点时恢复原始背景.
我使用了以下内容:
<script>
$(document).ready(function(){
$("input").focus(function () {
$(this.parentNode).css('background-image', 'url(images/curvedinputblue.gif)');
});
$("input").blur(function () {
$(this.parentNode).css('background-image', 'url(images/curvedinput.gif)');
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
但它没有替换图像,而是像您期望的那样向value2 div添加背景图像.在这种情况下,我可以使用parentNode.parentNode,但是inputboxImage节点也有可能在父树上进一步向上或向下.
有没有办法我可以更改这个代码,以便它将在父树下导航,直到找到一个名为inputboximage的div并替换那里的图像?
另外,如果我有两个不同的div类,inputboximage和inputboximageLarge,有没有办法修改这个函数,以便它可以同时使用它们,用每个不同的图像替换背景图像?
我们在 ActiveMQ 中遇到了一个问题,我们有大量的消息没有脱离主题。主题设置为非持久性、非持久性。我们的 Activemq.xml 文件是
<beans>
<broker xmlns="http://activemq.apache.org/schema/core" useJmx="false" persistent="false">
<!--
<persistenceAdapter>
<journaledJDBC journalLogFiles="5" dataDirectory="../data"/>
</persistenceAdapter>
-->
<transportConnectors>
<transportConnector uri="vm://localhost"/>
</transportConnectors>
</broker>
</beans>
Run Code Online (Sandbox Code Playgroud)
我们在 messages-config.xml 中的主题定义是
<destination id="traceChannel">
<properties>
<network>
<session-timeout>10</session-timeout>
</network>
<server>
<message-time-to-live>10000</message-time-to-live>
<durable>false</durable>
<durable-store-manager>flex.messaging.durability.FileStoreManager</durable-store-manager>
</server>
<jms>
<destination-type>Topic</destination-type>
<message-type>javax.jms.ObjectMessage</message-type>
<connection-factory>ConnectionFactory</connection-factory>
<destination-jndi-name>dynamicTopics/traceTopic</destination-jndi-name>
<delivery-mode>NON_PERSISTENT</delivery-mode>
<message-priority>DEFAULT_PRIORITY</message-priority>
<acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
<transacted-sessions>false</transacted-sessions>
<initial-context-environment>
<property>
<name>Context.INITIAL_CONTEXT_FACTORY</name>
<value>org.apache.activemq.jndi.ActiveMQInitialContextFactory</value>
</property>
<property>
<name>Context.PROVIDER_URL</name>
<value>tcp://localhost:61616</value>
</property>
</initial-context-environment>
</jms>
</properties>
<channels>
<channel ref="rtmps" />
</channels>
<adapter ref="trace" />
</destination>
Run Code Online (Sandbox Code Playgroud)
我想要实现的是,在任何时候都只有最后 10 条消息是关于主题的,因为让它在一夜之间运行会导致超过 150K 的关于该主题的消息,即使它应该只包含很少的数字。