Show Bid Request
Help with Javascript Bug
Bid Request Id: 27461
|
|
|
Posted by: |
jocksncops (9 ratings)
(Software buyer rating 10)
|
Non-action Ratio: |
Very Good - 18.18%
|
Buyer Security Verifications: |
Good
|
Approved on: |
Sep 14, 2002 2:11:48 AM EDT
|
Bidding Closes: |
Sep 28, 2002 2:30:51 AM EDT
|
Viewed (by coders): |
305 times
|
|
|
|
Description:
Hi attached is a sample ASP with some javascript that does not seem to be working correctly. The page dynamically inserts some elements using the document.createElement("xxx") syntax. This part works ok, but other things do not. There is some javascript code included in the setAttribute statement for one of the dynamically added items, but this code does not fire. My guess is that maybe the new item is generated outside of the form? But it seems to be in there properly as evidenced by clicking on the Show All button. Is it simply javascript does not work for dynamically added items?
In my example ASP page, there are only 3 buttons on the page that are of concern.
1. The button labeled "Button" - This one dynamically creates a button. 2. The newly created button "btn" - There is javascript in this button, but nothing happens. 3. The "Show All" button, this displays some HTML information about certain document elements. I added this because the "View Source" option does not include any dynamically added elements.
In a nutshell, I need to be able to dynamically create screen items that the user wishes to add, and I need each of these items to support javascript.
IMPORTANT: I am only looking for a bug fix, not an expensive complete re-write.
Deliverables: working code example
Platform:
browsers
Additional Files:
This bid request includes IMPORTANT additional attached files. Please download and read fully before bidding.
Remember that contacting the other party outside of the site (by email, phone, etc.) on all business projects < $500 (before the buyer's money is escrowed) is a violation of both the software buyer and seller agreements.
We monitor all site activity for such violations and can instantly expel transgressers on the spot, so we thank you in advance for your cooperation.
If you notice a violation please help out the site and report it. Thanks for your help.
|
|
Bidding/Comments:
|
All monetary amounts on the site are in United States dollars.
Rent a Coder is a closed auction, so coders can only see their own bids and comments. Buyers can view every posting made on their bid requests. |
See all rejected bids (and all comments)
Name |
Bid Amount |
Date |
Coder Rating |
|
|
|
This bid was accepted by the buyer!
|
$15 (USD)
|
Sep 14, 2002 4:46:54 AM EDT
|
10
(Excellent)
|
|
|
replace
object.setAttribute('onclick','javascript:alert('hello');');
with
object.attachEvent('onmousedown', myalert)
where function myalert() { allert ('hello'); } |
|
Attached File
|
|
|
|
N/A
|
Sep 14, 2002 4:48:29 AM EDT
|
10
(Excellent)
|
|
|
don't forget look to attach in previous message - you can find edited rentacoder.txt |
|
|
|
|
N/A
|
Sep 14, 2002 5:04:23 AM EDT
|
10
(Excellent)
|
|
|
!!!Pay attantion - previous script will work only in IE5+ so you need to use this!!!
function addEvent(elementPtr, eventType, eventFunc) { if (elementPtr.addEventListener) { //Works in NN6 elementPtr.addEventListener(eventType, eventFunc, false); } if (elementPtr.attachEvent) { //Works in IE5+ elementPtr.attachEvent('on' + eventType, eventFunc); } else { // make something if old browsers } }
function removeEvent(elementPtr, eventType, eventFunc) { if (elementPtr.removeEventListener) { //Works in NN6 elementPtr.removeEventListener(eventType, eventFunc, false); } if (elementPtr.detachEvent) { //Works in IE5+ elementPtr.detachEvent('on' + eventType, eventFunc); } else { // make something if old browsers } } Example, HowToUse: addEvent(mybutton, 'mousedown', myAlert) removeEvent(mybutton, 'mousedown', myAlert)
Don't forget look to attach! |
|
Attached File
|
|
|
|
|