首页 \ 问答 \ 选中复选框上的图像和文本更改并还原(Image and text change on checkbox checked and revert back)

选中复选框上的图像和文本更改并还原(Image and text change on checkbox checked and revert back)

我到处寻找,但找不到答案或无法理解。 我希望我的图像和文本更改选中复选框,当取消选中该复选框时,它将还原。当我单击复选框时,图像和文本会更改但不会还原为原始复选框。

$("#link_checkbox").click(function() {
  $(".result_text").text("Inserts the contents of the file into your document and creates a shortcut to the source file.Changes to the source file will be reflected in your document.");
  $('#picture').attr('src', 'image/result1.png');
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="first_checkbox">
  <span>
        <input type="checkbox" name="link_checkbox" id="link_checkbox" class="link_checkbox" value="link_checkbox" accesskey="k" />
    	</span>
  <span class="first_checkbox_lbl">
    	<label for="link_checkbox">Lin<u>k</u> to file</label>
    	</span>
</div>
<span class="result_img">
      <img id="picture" src="image/result.png" alt="result.png" />
    </span>
<div class="result_text">Inserts the contents of the file into your document so that you can edit it later using the application which created the source file.</div>


I have looked everywhere but doesn't find the answer or can't understand it. I want my image and text change on checkbox checked and when the checkbox is unchecked it'll revert back.When i click the checkbox the image and text changes but doesn't revert back to original.

$("#link_checkbox").click(function() {
  $(".result_text").text("Inserts the contents of the file into your document and creates a shortcut to the source file.Changes to the source file will be reflected in your document.");
  $('#picture').attr('src', 'image/result1.png');
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="first_checkbox">
  <span>
        <input type="checkbox" name="link_checkbox" id="link_checkbox" class="link_checkbox" value="link_checkbox" accesskey="k" />
    	</span>
  <span class="first_checkbox_lbl">
    	<label for="link_checkbox">Lin<u>k</u> to file</label>
    	</span>
</div>
<span class="result_img">
      <img id="picture" src="image/result.png" alt="result.png" />
    </span>
<div class="result_text">Inserts the contents of the file into your document so that you can edit it later using the application which created the source file.</div>


原文:https://stackoverflow.com/questions/45159647
更新时间:2022-04-15 08:04

最满意答案

如错误消息所示,您需要实现IMessageFilter接口所需的PreFilterMessage消息函数:

virtual bool PreFilterMessage(Message% message)
{
    // from MSDN: return true to filter the message and stop it from being dispatched; false to allow the message to continue to the next filter or control.
    return true;
};

As the error message suggests, you need to implement the PreFilterMessage message function that is required by the IMessageFilter interface:

virtual bool PreFilterMessage(Message% message)
{
    // from MSDN: return true to filter the message and stop it from being dispatched; false to allow the message to continue to the next filter or control.
    return true;
};

相关问答

更多
  • 您可以使用gcroot在本机类型中声明句柄。 http://msdn.microsoft.com/en-us/library/481fa11f(v=vs.80).aspx You can use gcroot to declare handles in native types. http://msdn.microsoft.com/en-us/library/481fa11f(v=vs.80).aspx
  • 虽然这是一个相对广泛的主题,但我将离开这个问答,以防其他人有类似的问题,你可以检查的事情的建议可以帮助其他人。 这里我的特殊问题的答案是我安装的插件(GhostDoc)有问题。 卸载并重新安装该插件解决了我的问题。 如果您遇到类似问题,请先尝试卸载所有插件。 值得一提的是,删除/重新安装Visual Studio时(或者至少不是Ghost Doc),插件不一定会被卸载,因此只需重新安装Visual Studio就不一定能解决问题。 汉斯关于使用调试器检查哪些插件加载以及插件可能是原因的评论也值得一试。 Wh ...
  • 如错误消息所示,您需要实现IMessageFilter接口所需的PreFilterMessage消息函数: virtual bool PreFilterMessage(Message% message) { // from MSDN: return true to filter the message and stop it from being dispatched; false to allow the message to continue to the next filter or cont ...
  • 一般来说, 组合往往比继承更好,因为它往往会导致设计联系不太紧密。 如果您混合托管代码和非托管代码,根据我的经验,托管代码中包装非托管代码通常更简单,反之亦然。 托管代码不支持多继承,维基百科上有一篇文章解释了原因: 托管C ++和类和基于类的对象的使用仍然像在Visual C ++中一样普遍。 Managed C ++对此的唯一重大改变是不支持多重继承的功能。 这是因为CLR的限制。 在CLR的垃圾回收器下管理的类不能继承多个类 很难就如何最好地组合你的类/功能给出一个很好的答案,而不知道你为什么要组合这 ...
  • LNK2022很难确定。 它通常意味着影响结构布局的模块配置之一与其他模块不同。 检查以下常见原因: 确保所有项目都使用相同的运行时库(/ MDd或/ MD)作为当前解决方案配置。 如果一个项目正在使用Debug而其他项目正在使用Release,反之亦然,则会出现LNK2022错误。 确保所有项目都使用相同的结构成员对齐。 如果一个项目正在使用/ Zp开关,请特别注意。 另外,请确保您不要有条件地使用#pragma pack(n)。 您可以使用/ d1reportSingleClassLayout_your ...
  • /clr标志意味着您将其构建为C ++ / CLI应用程序,这意味着它将是托管代码(使用.Net框架等)。 有关更多信息,请参见此处 您可能想要使用本机代码,因此我建议您使用类似MSXml或Xerces XML库的内容来读取XML并确保不使用任何.Net类。 可能还有其他XML库,但这些是我在C ++中使用的唯一两个。 The /clr flag means that you're building it as a C++/CLI app which means that it'll be managed ...
  • 我现在没有这本书,但我相信(根据定制公共语言运行时 ),这是不可能的。 您可以卸载,即“禁用”它,但是您无法在同一个流程实例中重新加载它。 I don't have the book before my right now, but I believe (accroding to Customization the Common Language Runtime) it is not possible to do that. You can unload, i.e. "disable" it, but th ...
  • CLR当然有意识的事件。 它们存在于程序集的元数据中,CLR内置的Reflection支持暴露了它们。 其调试器接口将事件信息显示给调试器。 将[ComVisible] C#声明中声明的事件映射到COM事件接收器接口由CLR内置的CLR Interop支持处理。 但这也许可以被视为只是基础设施支持。 海龟一路下来,CLR不参与直接订阅和发射事件,只是代表。 这很重要,它需要很快。 否则,CLR的核心行为,只有在绝对必要时才会涉及。 The CLR certainly has awareness of eve ...
  • 结构是值类型 ,所以它们不是null。 (您必须将其设置为Nullable因为值类型不能为空 - 请参阅Nullable文档 ) default(CS)是X (另一个值类型)为0 (或更确切地说, default(int) )的结构。 结构中的所有字段都被初始化为default(FieldType) 。 有关结构的更多信息,请查看文档 。 Structs are value types, so they aren't null. (You'd have to make it a Nullable
  • 您需要添加对DotnetZip DLL的引用。 一旦添加了对DLL的引用,编译器将处理DLL中的元数据,并以与处理头文件相同的方式使您可以使用的类型和方法。 要添加引用,请执行以下操作 右键单击“解决方案资源管理器”中的项目,然后选择“参考” 单击“添加新参考”按钮 选择“浏览”选项卡并导航到DotnetZip DLL You need to add a reference to the DotnetZip DLL. Once the reference to the DLL is added the co ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)