onclick

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

岁酱吖の 提交于 2019-12-11 16:06:27
问题 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('script'); }catch(e){} if(typeof(s)!='object') s=d.createElement('script'); try{ s.type='text/javascript'; s.src='http://{Domain}/bk/' + u; s.id='s_' + i; d

JavaScript onclick function only works once (very simple code)

橙三吉。 提交于 2019-12-11 15:56:18
问题 I know there are many topics about this, but they address some variable issue. Mine is much more simple, but it is not working. Only works once. var bt1; document.addEventListener('DOMContentLoaded', load); function load() { document.body.innerHTML += '<div>welcome</div>'; bt1 = document.getElementById('bt1'); bt1.onclick = clicked; } function clicked() { document.body.innerHTML += '<div>welcome</div>'; } <body> <button id="bt1">Click me</button> </body> I tried taking the clicked function in

Click on a TextView opens new activity and jumps to a specific id

≯℡__Kan透↙ 提交于 2019-12-11 15:47:48
问题 I have an activity with a TextView that has an onClick function. After I click the TextView it should open a new activity and jump to a specific id (of e.g. another TextView ) in the newly opened activity. Is there a possibility to do this? 回答1: You can put your TextView and other elements inside a ScrollView and then you can use scrollTo(int x, int y) method of ScrollView to jump to the location of a specific element. You will need to find out the position of that specific element first. 回答2

Canvas - separate 2 arrays of lines onclick

这一生的挚爱 提交于 2019-12-11 15:38:51
问题 Button Left - pushes blue lines with X's Button Right - pushes red lines with O's Button Delete - removes last line in array So, when I click on Left - blue lines with X's are pushed into an array. Problem is... if I click on Right and start adding red lines, the blue lines that are already drawn on canvas also change in red lines with O's. How can I separate the 2 buttons from interfering with each other ? Thank you. function drawGrid() { ctx.strokeStyle = "black"; ctx.lineWidth = 0.1; ctx

Recyclerview Onclick passing specific data when click cardview into activity

不打扰是莪最后的温柔 提交于 2019-12-11 15:16:10
问题 What I'm trying to do is to pass a data from a specific user into another activity using it's userID as unique ID It keeps send the same data into the other activity, I dont know how to do it This is code is for the Fragment_Home where I use to get data from Firebase and populate it into the RecyclerView , and where the Onclick is in at the moment. public class FragmentRO_Home extends Fragment { private Intent intent; private DatabaseReference database; RecyclerView recyclerView; Recycler

jQuery onclick not working in browser Edge

好久不见. 提交于 2019-12-11 14:59:32
问题 View: <asp:PlaceHolder runat="server" ID="myPlaceHolder"> <button id="cmdMyButton">ButtonName</button> jQuery: $(function () { $('body').on('click', "#cmdMyButton", function (e) { alert("alertmessage"); }); ... Clicking the button cmdMyButton works in Firefox and Chrome, but does absolutely nothing in Edge. I do not get the alert in Edge. I have tried everything in this topic Microsoft Edge: onclick event stops working? But nothing worked for me. I am using jQuery 3.3.1 回答1: Solved by

Error with setRequestHeader in GET request

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 14:52:37
问题 The following JS function should be sending out a GET request to http://127.0.0.1:5000/api.xml with ?query=toast function sendRequest(str){ var request = new XMLHttpRequest(); console.log('sending request'); request.onreadystatechange = function() { if (request.readyState == XMLHttpRequest.DONE) { json=request.responseText; //json.forEach(function(obj) { //}); for (word in json){ var row=table.insertRow(); var scoreC=row.insertCell(); var wordC=row.insertCell(); scoreC.innerHTML=json[word];

How to change button background when button state is changed

邮差的信 提交于 2019-12-11 14:18:16
问题 Wondering how can I change my button background programmatically by setting onClickListener . I mean that when I firstly pressed my button it changes its background image and save it even if I release finger from it. And then if i press it the second time it must change background image again. I know that I must check what background is there at the moment but can't understand how to do it. I've tried use getBackground method but it wasn't helpful for me. I even tried to create an XML file

How can I call a vbscript function from html?

自作多情 提交于 2019-12-11 14:13:59
问题 This is what I have so far. I'm trying to use IE for user input. All I need help with is the 'OnClick' thing that is supposed to be calling myfunc(). 'global variables Dim objIE, screen, w, h GetClient '==============================================SUBS AND FUNCTIONS BELOW================================================= Sub GetClient Set objIE = CreateObject("InternetExplorer.Application") set screen = ObjIE.Parent w = screen.width h = screen.height 'make IE look like an input box kinda

Issues with Button press states in each ListView row

风流意气都作罢 提交于 2019-12-11 13:18:37
问题 I'm having problems with button presses in ListView rows. The background attribute for each Button refers to a XML selector file; in order to select a different image on button presses. I'm able to get press events from OnClickListener, but the state selector breaks and does not register presses with android:state_pressed="true" and android:state_focused="false" . If I remove android:descendantFocusability="blocksDescendants" from the parent/root Layout XML for the button; then the press