onclick

Apply "onclick" to all elements in an iFrame

How do I use the JavaScript DOM to apply onclick events to links inside of an iframe? Here's what I'm trying that isn't working: document.getElementById('myIframe').contentDocument.getElementsByTagName('a').onclick = function(); No errors seem to be thrown, and I have complete control of the stuff in the iframe. Here is some code to...

How can I simulate an anchor click via jquery?

I have a problem with faking an anchor click via jQuery: Why does my thickbox appear the first time I click on the input button, but not the second or third time? Here is my code: <input onclick="$('#thickboxId').click();" type="button" value="Click me"> <a id="thickboxId" href="myScript.php" class="thickbox" title="">Link</a> It...

How to make a linkbutton onclick with parameters

HTML : <asp:LinkButton ID="lnk_productImage" runat="server" Text="select" OnClick="viewProductImage('<%#DataBinder.Eval(Container.DataItem,"Id") %>')" > </asp:LinkButton> CodeBehind: protected void viewProductImage(object sender, EventArgs e, int id) { //Load Product Image } ...

asp:ImageButton not firing onclick event

I have a page that uses a master page, several RequiredFieldValidators, and the Web Toolkit autocomplete extender. The following code only shows the bare minimum of the page: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" MasterPageFile="~/master.master" Inherits="Login" %> <asp:Content id="...

Add onclick property to input with JavaScript

I am creating a user input at one of the events: var throwConnectBox = function() { chat_box = document.getElementById('box'); div = window.parent.document.createElement('div'); input = window.parent.document.createElement('input'); input.type = "submit"; input.value = "Join chat"; input.onclick = "conn.send('$co...

html link to change the value of a textbox

Hi, I am trying to create text in html, that once clicked, the the value of a textbox residing near it, changes its value to be equal to that of the text clicked. Is there anyway I can do that? In other words I want the functionality of a button (the onClick event) for a link/text. Thank you For example: What's wrong with this? <td...

jQuery click function vs inline onclick

I'm trying to reorganize my code and make it more unobstrusive. Mainly, there is a link for performing an action. If you click on the link, the action is performed via ajax (the ajax code is not on the code here) and the text is replaced by other text, offering the user the ability of undo the action. If the user click the Undo link, aj...

jquery, prevent onclick=window.location on parent element

I have a table with data such as this: <table> <tr onclick="window.location='download.php?id=1'"> <td>Program 1<br/>Short Description 1 (<a onclick="$.popup.show('Install Instructions', 'Instructions pulled from DB here')">Instructions</a>)</td> <td>Added by user and date/time here<td> <td>Filesize here<td> <td><a href="edit.ph...

Placing a Click event on an achor tag in html from javascript?

Hi there, Can anyone help, seem to have an issue placing a onclick event of an anchor tag, it works on an image.. I have this this.whereAreWe = document.getElementById('where_are_we'); this.whereAreWe.onclick = this.whereAreWe; I have placed a A tag using the id of "where_are_we" ... but it never executes.. if I change it to an imag...

JavaScript: changing the value of onclick with or without jQuery

I'd like to change the value of the onclick attribute on an anchor. I want to set it to a new string that contains JavaScript. (That string is provided to the client-side JavaScript code by the server, and it can contains whatever you can put in the onclick attribute in HTML.) Here are a few things I tried: Using jQuery attr("onclick",...

Attaching onClick event to Rails's link_to_function

How do I attach an onclick event to a link_to_function such that clicking on the event refreshes an element on the page (using partials)? When the user clicks the generated link, I'd like to refresh the partial containing the code so that i gets updated. def add_step_link(form_builder) logger.info 'ADD_STEP_LINK' link_to_func...

Server-side Javascript (aspx.cs) Attributes.Add Code to Change a Label's text

I am trying to change a label's text by using server-side javascript (onclick) and C# within the page_load event. For example, I would like to write something like the following: Label1.Attributes.Add("onclick", "Label2.text='new caption'") Does anyone know the correct code for this? Also, what is this type of code referred to; is it...

OnClick without jQuery

How to make OnClick without jQuery, with no extra code in html, such as: <a href="#" onclick="tramtramtram"> just using an extrnal js file? <script type="text/javascript" src="functions.js"></script> Need to replace this code: $("a.scroll-up, a.scroll-down").click(function(){SNavigate($(this).attr("href").substr(7));return fals...

Why does this bookmarklet JS code not work when put in an onclick handler?

I have a pretty typical bookmarklet code that's working perfectly for me in all browsers. However, when I take this code and put it in an HTML's element onClick handler, it doesn't work in IE (6, 7, or 8). This is the code: javascript: ( function(){ function l(i,u){ var d=document; var s; try{ s=d.standardCreateElement(...

Adding dynamic widgets to a panel (GWT)

I'm having trouble adding a variable amount of labels to a panel. My problem is that for some reason when adding my clicklistener it returns void instead of widget (error). If I just have "new Label('xyz')" that works fine, but I need each panel to have their own clicklistener as well. Here is the code: for(int x = 0;x<productIDArray...

Click event on table row - only trigger if nothing else is 'clicked'

Hello StackOverflow, I'm having some issues with some jQuery code, and I'm hoping and thinking that the solution is relatively simple. Say I have a table like: <table> <tr> <td><input type="checkbox" name="hai" value="der" /></td> <td><a href="mypage.php">My link</a></td> <td>Some data</td> <td>Some more data</t...

ASP.Net Onclick event doesn't work with ajaxcontroltoolkit

Hi guys, I designing a web application using vs2008 and c#. I already have done many versions of it and all of them seems to be working fine. Yesterday i decided to replace de vs calendar with a ajax calendar and to do so i used ajaxcontroltoolkit. The new calendar is also working fine. But the buttons i have in my form stoped to work...

Javascript firefox extension to get the text around the link

Hi, Is it possible for me waiting for a user to click a link, and upon clicking the link the link's text would be obtained? Maybe by using onClick? ...

JavaScript: Adding an onClick handler without overwriting the existing one

I'm trying to modify all links on a page so they perform some additional work when they are clicked. A trivial approach might be something like this: function adaptLinks() { var links = document.getElementsByTagName('a'); for(i = 0; i != links.length; i++) { links[i].onclick = function (e) { <do some work> return true; }...

Jquery - mouse over -> fade in/out // click -> opacity 100% // other click -> opacity 60

Hello, Iam working on a website with jquery and thumbnails. When the page is loaded all the thumbnails have to be on 60% of opacity. As soon as you go with your mouse over a thumb it needs to fade to 100%, if you move with your mouse out the thumbnail needs to fade back up on 60% of opacity. When the user click on a thumbnail it have ...