使用JavaScript将参数发送到mouseover事件 [英] Sending parameter to mouseover event using javascript

查看:445
本文介绍了使用JavaScript将参数发送到mouseover事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的ASP.NET(C#)代码中调用javascript函数,

tag_label.Attributes ["onmouseover"] ="tooltip.show(``硬编码值:'');
在此硬编码值" 之后,我想向该方法添加一个变量(字符串).我应该如何传递这些值? 例如:
string var = India;(此字符串值会像我们,英国,日本人一样以编程方式更改...)
tag_label.Attributes ["onmouseover"] ="tooltip.show("硬编码值:);";
鼠标悬停时,工具提示显示应为"欢迎来到印度"?如何实现?
请帮助我...

I want to call a javascript function from my ASP.NET (C#) code,

tag_label.Attributes["onmouseover"] = "tooltip.show(''Hard coded value:'');
after this ''Hard coded value'' I want to add a variable (string) to the method.How should i pass these value??
for eg:
string var=India;(this string value changes programmaticly like us,uk,jappan etc...)
tag_label.Attributes["onmouseover"] = "tooltip.show(''Hard coded value:'');";
the tooltip display should be "Welcome to India" on mouseover how can i achive this??
help me please...

推荐答案

尝试一下.工作正常.

Try this..working fine.

string passstr = string.Empty;
passstr = "I Love My India";
tag_label.Attributes.Add("onmouseover", "tooltip.show('"+ passstr +"')");



我尝试了什么,因为未为我分配tooltip.



What I tried, because tooltip is unassigned for me.

string passstr = string.Empty;
passstr = "I Love My India";
tag_label.Attributes.Add("onmouseover", "alert('"+ passstr +"')");




谢谢
灰烬




Thanks
Ashish


这篇关于使用JavaScript将参数发送到mouseover事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆