I have been using a tr onclick function in my tables to change the color of the most recently clicked row, it works fine. I have recently added sorttable [URL] to my table with the simple
<table class="sortable">
Making the table sortable has overwritten my tr onclick functions, which are now dead.
Heres a quick sample of what it looks like:
<table class="sortable">
<thead><th scope="col">Header 1</th>
<th scope="col">Header 2</th></thead>
<tr onclick="doSomething(this);"><td>Some data</td><td>Some more</td></tr>
</table>
I was having no problems at all testing at home (FF, in private mode to keep cache clear, and error console to check... also Opera and Safari) when I suddenly lost functionality on several jQuery functions, all of them similarly structured. Couldn't find the problem; updated jQuery; stripped the codes back to one particular function; still no clue.
So: now the puzzle isonline. The calls to load the elements in the page are in the <body> tag. These capabilities work correctly: resizing, scrolling with arrows, popup from underlined link, dragging. What doesn't work is what should happen when you hover on any of the six-line figures: You should see a number underneath and on click, a change of color, and new text on the left.
Script file: hover is at line 100; the click function at line 78. The calls for the click function are here: Testing again online, Opera (mac) now functions correctly. So, I think it may be something to do loading. I've put a delay to make sure the elements to be operated on are loaded before the functions which do the operating. Still no dice. It also seems to load really slowly, but that's minor at this point.
dataCheck validates the inputs value and if something is wrong, then.. document.getElementById('error_anInput').innerHTML = 'Error!' or if data is valid then the content of span is removed.
The checkWholeForm function iterates through all elements on the form and triggers onblur() for each input... leading to executing function dataCheck (and so changing innerHTML of some specific span elements if needed).
*The Problem* If I have entered incorrect data to an input and hit the submit button with my mouse (causing the onBlur event to be triggered just right before onSubmit) then *occasionally* for some fields the onSubmit event is not triggered because the onClick event is not triggered. :S
As there are actually quite many complex functions (tested and these seem OK afaik) that are doing the checks then dowes anyboudy have a clue what type of code might break this. I thought at first that setting innerHTML to some value during onBlur disables all waiting events but as this is happening occasionally (on some machines) I'm in doubt...
any ideas what to check? double declaration of function/variable names? Not deleting some object after usage? ... anything?
Waiting for any ideas...
PS. http://eix.lap.ee/test/portali_js.html in the example *occasionally* third field generates the error - remove any content from the field and stright hit the submit (*with mouse* - to create onBlur and onClick at the same time).
I am in the process of creating a billboard script for our company front page which will switch between two images. I am using the following script as a base: [URL]
I am eager to learn coding, but am still a novice at it so I was wondering if anyone could assist me with adding the following functionality:
1. Rather than (or perhaps in addition to) having the two images change based on a timer, I'd like to be able to insert a "next" arrow. Therefore I will need assistance in coding a button to change the images from "ad_1" to "ad_2" which is currently done automatically by the interval timer
2. I'd like to make the images clickable with unique destinations (so when you click on "ad_1" it will take you to "link 1", "ad_2" will take you to "link 2"
Below is my current code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head>
I am trying to add functionality to a table that allows users to add and remove table rows, but I am stuck on the JS part of it. The JS I am working with allows users to add/remove table rows that are populated with text input fields, but I want it so where the rows are populated with these elements: 1) multiple select with populated options, 2) file upload box (input type="file"). How to modify the JS below to do this (I am new to JS).
Here is the JS I am working with: Code: function addRow(tableID) { var table = document.getElementById(tableID); var rowCount = table.rows.length; var row = table.insertRow(rowCount);
var cell1 = row.insertCell(0); var element1 = document.createElement("input"); element1.type = "checkbox"; cell1.appendChild(element1); .....
I want to add this functionality to my table....when page loads I want the <div> tag be disabled...so that all the elements within the <div> be disabled.
But when the user clicks the enableDiv button, the <div> becomes enabled.
I have been working on a paging and it all works fine , the codeit's based on the code from this page [URL]
I have tried to recreate thenavigationto work before and after the table I can put the data there but it does not worksimultaneously the before and after navigation
I have tried several solutions but I can't get it to worksimultaneously
I try to do <table> where every <td> -cell works like a link and onmouseover color changes. Problem comes when table is inside with an other table. Onlick seems to work in that cell which is on bottom. Is it possible to do it that cell-link which is on top works?
I have table with many rows indicating my record. I want my rows to load my record, so I attached an onClick event to every row that loads the proper record. Now, there are options associated to every record (delete link, select checkbox, etc) that don't result in loading the record. The problem should be obvious, upon the user clicking on any of those options, the row's onclick is triggered which is undesirable behaviour.
I'm trying to create a dynamic table with onclick event like this but onclick event seems to do nothing:
var srcTable = this.iContext.getElementById("tbody"); var tmpRow = null; var tmpCell = null;[code]...
I found a few examples like this: tmpRow.onclick = function() { alert(this.rowIndex);};
but I need use selected data, maybe call a defined function. I already tried lines bellow but nothing works, because doSomething is not function of tmpRow object.
tmpRow.onclick = function() { doSomething(this);}; or tmpRow.onclick = doSomething(this); or
I am trying to get the value of a table cell that is generated by a php loop. The purpose is so eventually I can click a row out of a list and have it take me to a form view of the list item that is clicked. I've searched and searched for the last few days for something with no luck. I run across a lot of hits that tell me I need to have an id for everysingle thing I click on but there has to be a better way.
Code: function test() { var elTableRow = document.getElementById("tr");
I have a php page that essentially builds a pay report in the form of a table. The php side builds the page properly, though it took some time to get the table rows onmouseover and onmouseout functions to work for row highlighting. Now the issue is the table row's onclick function.
Here is what the outputed html looks like. <head><script type="text/javascript" language="javascript"> function HideShowDiv(divID){ if (document.getElementById(divID).style.display == "none"){ document.getElementById(divID).style.display = "block"); document.writeln("show "+divID); }else{ document.getElementById(divID).style.display = "none"; document.writeln("hide "+divID); }} .....
<tr> <td colspan="2" align="right">Some Association of Baseball</td> <td align="right">$24</td> <td align="center"></td> </tr> </table> </div> <!-- Closes the main body div container -->
In my javascript function, the writeln() calls are for testing to see if the even is even firing. but nothing gets written to the page. Basically I want the row with the users name to be clickable which will show the details in the hidden div associated with the user.
The code below assigns a value to the Latitude and to the Longitude table cells when the submit button is pressed. I would like to have these values appear in text boxes instead. Obviously I need to amend onclick="javascript:usePointFromPostcode(document.getElementById('postcode').value, placeMarkerAtPoint)" to make this work but I can't seem to. Assuming two text boxes with names lng and lat, how would I amend the line?
I have this table with alternate row colors. Class gray and class white. I have javascript that do highlight when mouseover row ... and onclick to select row and highlight it with another color. Also created a class called "Selected". You can only select a row at a time.
My problem is, if a row is preselected, when mouseover the selected row, the selected color is screwed. Until you click on the selected row once, the behaviour is correct again. Code:
I have a wapper here, and I'm going crossed eyed trying to figure this one out. I have a form with Radio Buttons for my customers to purchase a customizable club program. I have 5 sections each of which cost a certain amount. Then I have another section that lets the user pick what duration they would like, 3, 6, 9 and 12 months. Each option has a certain % taken off the retail price. 5%, 10%, 15%, 20% depending on the duration option. All calculations are done on the fly as customers click the radio buttons. I do have it set up and working, only I have the duration listed as many times as my sections. I would like to have only one duration section. I'm not sure if this is done in java or HTML....
So basically, the getStats method parses the response to get the info I need for that particular request and then updates the html of the current page accordingly. This works fine for 1, 2, or 3 data requests. But if I have more, some of the httprequests get lost and not all parts of my page are updated. But, if I throw in an alert in each loop, all page data or at least more of them are updated, once per time after each loop. It's like the alerts slow the loop down and allow the requests and updates to catch up to the loop processing.
So, I'm not sure what's happening when the alerts aren't there. Are some of the requests getting clobbered somehow? Are the httprequests fine, and maybe the original document can only be updated once at a time?
I implemented some code to perform highlighting and specific anchors are used for the searched words. The problem is when the searched words are inside <a href> tags, the links are lost after putting my anchors.For example:
I am relatively new to js, but I did think I was starting to get the hang of it. Then this happened...
I have a form with an onsubmit event handler: <form id="uploadForm" method="post" action="..." onSubmit="checkDates()">
The event handler does some minor validation, then returns true or false:
function checkDates(y, m, d) {
if (endDate.getTime() >= startDate.getTime()) return true;
alert("Start date must precede end date"); return false; }
(The arguments to the function are used when it is called elsewhere, not as onsubmit.)
I also have a library class which needs to process the form submit, so it hooks onsubmit like this: MyClass.setOnSubmit = function(listId) { var list = document.getElementById(listId); var form = list.form;
var f = form.onsubmit; if (typeof f == "function") { form.oldOnSubmit = f; form.onsubmit = function(){ var ok = this.oldOnSubmit(); if (ok) return MyClass.onsubmit(listId); else return false; }; } else form.onsubmit = function(){MyClass.onsubmit(listId);}; }
My problem is that the value returned from oldOnSubmit and stored in ok appears as 'void'. This happens in IE 6 and in FireFox 1.07. Can anyone explain what's happening?
I have situation that when my page is loaded i create js object <html> ... <script> function Page() { this.page = 0; this.result = 0 this.resultCount =1; this.currentPage =1; } MyPage= Page() </script> then in my javascript function i use object like this:
function getPage() { if(!MyPage) { MyPage = new Page(); } return MyPage; }
but there is one problem: MyPage lost one of the property, currentPage. When i do alert(MyPage.cuurentPage) shows mi undefined. After object initialization everything seems to be alright, currentPage is set to 1 but when i Try use MyPage in my js code is already set to undefined. What happen? What I'm doing wrong?
I have a problem that the window.opener variable is lost once my popup page has a postback. On multiple pages they address this problem but I cannot find a correct answer.
This is my situation:
I have a main page which shows invoices. When a user clicks on the invoices they get a popup where they can alter the invoice which uses postbacks because of direct changes in the database. Finally the user can click a button to accept the invoice and then I need to change two variables on the main page which opened this popup, the new invoice fee and status (which is based on the button pressed). I dont want any postbacks on the main page, therefore I simply want to pass these two variables from the popup to the main page.
However, after a single postback on the popup page the window.opener variable is gone and lost forever. Now I have seen solutions using frames but I do not know how to go from there because I also pass some variables from the main page to the popup.
I have a series of elements on the page that have been assigned anonymous functions as a user works with them. At a certain point I would like to take a element and all of its children and copy them from their current location and into a newly created element. Then remove original version and all its children.
I have done the above by using innerHTML to copy the element and its children to a temp variable.. problem is that I think my copy has lost all these anonymous function that was assigned to the original version. Has anyone ever faces the problem of trying to copy a series of elements and losing their anonymous assigned functions in the copied version? If so whats the work around on this?
I am in the process of creating an ajax like upload control (like the one described here: [URL].. I have ran into an unexpected problem that I can't seem to find a solution to. Javascript is not my favoured tech, and maybe there is something fundamental about this that I don't understand. could point out what I'm doing wrong:
I am using setTimeout to basically show a dummy progress bar (by manipulating backcolour of td elements). I start the process like this:
I want to have a popup that shows up if the user loses connection to my website, i would prefer it to be in jQuery as that's what I'm using, and it seems more light weight on the page
I have this code, but it doesn't seem to work... it should check on document ready then keep trying every 5 seconds