473,413 Members | 1,727 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

pass text to javascript function

Hello,
I found this code and I want to pass this function a value
from a dataset.

How do I do this?

<INPUT onmouseover="func()" type="button" value="Button">
<script type=text/javascript>
function func()
{
//you could put anything here, e.g. opening a window etc.
alert('Hi');
}
</script>
Nov 18 '05 #1
2 1606
<INPUT runat="server" id="myButton" onmouseover="func()" type="button"
value="Button">

In the code behind (C#):

myButton.Attributes["onmouseover"]=String.Format("func({0})", "my text");

Eliyahu

"prav" <pr**@hotmail.com> wrote in message
news:10****************************@phx.gbl...
Hello,
I found this code and I want to pass this function a value
from a dataset.

How do I do this?

<INPUT onmouseover="func()" type="button" value="Button">
<script type=text/javascript>
function func()
{
//you could put anything here, e.g. opening a window etc.
alert('Hi');
}
</script>

Nov 18 '05 #2
Eliyahu Goldin wrote:
<INPUT runat="server" id="myButton" onmouseover="func()"
type="button" value="Button">

In the code behind (C#):

myButton.Attributes["onmouseover"]=String.Format("func({0})", "my
text");

Eliyahu


You might want to put quotes around that text:

String.Format("func('{0}')", "my text");

(and then you could still have problems with quotes inside the string)
Hans Kesting
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Matt | last post by:
My problem is to allow ASP to interact with JSP, and I pass JavaScript object in my approach, but I wonder if it will work in network, not just in local machine. For testing purposes, the...
7
by: olga | last post by:
Hi, On my site, i want to pass a javascript variable to php. I know that this needs to done in a link or in a post. I want to know if there is a way i can do it with an html link. I should...
2
by: Shabam | last post by:
I need to have a static html page basically pass all GET arguments from one page to another. For example, I'm on page A. It has "x=12&y=45". There's a link on page A that goes to page B. Page B...
3
by: quickcur | last post by:
Hi, I am writing a javascript function. The idea is this very similar to the "color picker": 1. You have a html page where you have many text fields. Suppose each of them is a child's name....
2
ronverdonk
by: ronverdonk | last post by:
I hope someone can show me the right direction for solving my problem. I have program where a user can enter text in a <textarea>. I want to give that user the possibility to have a pre-look at...
1
by: praveenit | last post by:
hi, I am writing a small java script code where , when the textbox is clicked a pop up window is opened . on entering some data in the text area present in pop up window and pressing ''save"...
1
by: colleen1980 | last post by:
Hi: Can any one please tell me that how to i pass the two textbox values in the new page. If i use the form action in the popup window page then the new page is open in the same popup window as i...
5
by: JohnDriver | last post by:
Hi, I am having a form which has a text box and 3 radio buttons. I am using GET method in Ajax to pass the value. I can pass the value of the textbox fine but how to pass the value of radio...
1
by: mchen1117 | last post by:
I try to display a random image alone with text and link, I find this javascript and did some edit as needed, I don't know how I can pass document.write() value to HREF's URL, Please help ...
3
by: swetha123 | last post by:
hello, I don't know how to use cookies please help me in this I am using the dream weaver cs4 I designed the navigation bar to my page using dream weaver cs4 navigation bar contains...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.