•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 427,415 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,518 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1406 | Replies: 4 | Solved
•
•
Join Date: Feb 2008
Posts: 7
Reputation:
Rep Power: 0
Solved Threads: 0
i have been trying to find a way to do it, but i can't seem to think of one. i need to do this:
but i want to use .onclick instead of .onmouseover and .onmouseout
i have come up with this:
but i still have not found a way for it to detect if it has been clicked before.
any help would be apreciated
javascript Syntax (Toggle Plain Text)
var animElements = document.getElementById("resizercontainer").getElementsByTagName("p") for(var i=0; i<animElements.length; i++) { animElements[i].onmouseover = widthChange; animElements[i].onmouseout = widthRestore; } function widthChange() { if (!this.currentWidth) this.currentWidth = 150; doWidthChangeMem(this,this.currentWidth,170,10,10,0.333); } function widthRestore() { if (!this.currentWidth) return; doWidthChangeMem(this,this.currentWidth,150,10,10,0.5); }
but i want to use .onclick instead of .onmouseover and .onmouseout
i have come up with this:
javascript Syntax (Toggle Plain Text)
var animElements = document.getElementById("both").getElementsByTagName("p"); for(var i=0; i<animElements.length; i++) { if (currentwidth = 150){animElements[i].onclick = sizeChange;} else {animElements[i].onclick = sizeRestore;} } function sizeChange() { if (!this.currentWidth) this.currentWidth = 150;//if no mem is set, set it first; doWidthChangeMem(this,this.currentWidth,170,10,10,0.333); } function sizeRestore() { doWidthChangeMem(this,this.currentWidth,150,10,10,0.5); }
but i still have not found a way for it to detect if it has been clicked before.
any help would be apreciated
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Array Names (JavaScript / DHTML / AJAX)
- Converting from Output to Input ! (PHP)
- Slide In, Slide Out, ala Digg (JavaScript / DHTML / AJAX)
- Toggle div visibility (JavaScript / DHTML / AJAX)
- SQL query problem with WHERE clause (ASP)
- Switching visible divs works in IE, not in FF or Opera (JavaScript / DHTML / AJAX)
- Code to Hide TaskBar etc? (HTML and CSS)
- Creative element selection with JavaScript (JavaScript / DHTML / AJAX)
- Java Help!!! (Java)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Running scripts w/out IE disabling them
- Next Thread: cookie



Threaded Mode