473,385 Members | 1,707 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,385 software developers and data experts.

How to access Javascript variable from Code behind

Hi,

Can any one help me.

i have created one color pallet. if i click particular color, it will set as background-color of CardTable.

I want to access the particular set in the CardTable from Code behind file. What is the way to access the color. Here is the sample code

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2.  
  3. <html>
  4. <head>
  5. <title>Page title</title>
  6. <script type="text/javascript">
  7. <!--
  8. function DesignCard(GetValue)
  9. {
  10.     document.getElementById('CardTable').style.backgroundColor  = GetValue;
  11. }
  12. //-->
  13. </script>
  14. </head>
  15. <body>
  16. <asp:Table ID="CardTable" Runat="server" CellPadding="0" CellSpacing="0" Width="600" CssClass="tableborder">
  17. <asp:TableRow>
  18. <asp:TableCell ID="Header">
  19. <asp:label id="LblHeader" runat="server">Hi My Dear</asp:label>
  20. </asp:TableCell>
  21. </asp:TableRow>
  22. </asp:Table>
  23.  
  24. <a onclick='javascript:DesignCard("#FF6600");'>Orange</a>
  25.  
  26. </body>
  27. </html>
Feb 21 '07 #1
1 1815
kenobewan
4,871 Expert 4TB
Try using attributes.add() for the onclick event, you will need a page element that is runat server to initiate it.
Feb 21 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Andy Fish | last post by:
Hi, can anybody put forward a sensible argument javascript's behaviour of creating a new global variable whenever I assign to a previously undeclared variable. I can't beleive this is just for...
8
by: Jade | last post by:
I saw some web page saying I could do it this way in javascript: var iNumber = <%#publicvarname publicpropertyname %> but it doesn't seem to work. I have this piece of code here in...
3
by: Parveen | last post by:
I have a boolean variable defined in the aspx.cs code for my webpage. I need to read the value of this variable in the javascript code that i have in the codebehind file. Is there a way to do...
5
by: Dan | last post by:
We have a simple site. It's a frameset with two frames a left and a right. The left frame is essentially a list of records from a database (using a server-side repeater control). When you click...
1
by: Machi | last post by:
let say i have a web form with a button on it ... when i click the button, it will pop up one small window to allow me to save a pdf file, everything is done using code behind as below ... however,...
5
by: Paul | last post by:
Just wondering if someone could provide an example of passing a variable from the code behind to javascript in vb. I want to have one control have focus with the page loading with one condition...
1
by: Evan Kontos | last post by:
I have the need to test for the value of a client variable from a server control in a VB Web form. How can I do this in VB. Net? Evan Kontos | EKontos@comtekcadd.com 27 Whitehall St. | ...
2
by: sorobor | last post by:
dear sir .. i am using cakephp freamwork ..By the way i m begener in php and javascript .. My probs r bellow I made a javascript calender ..there is a close button ..when i press close button...
5
by: mesut | last post by:
Hi there, how are you colleagues? I try to set a linkaddress in code behind for a <asp:hyperlinkserver control. but I think I have some syntax problem. I don't know how to fix it. What's...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.