| | |
RegExp.replace Not Working
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jul 2005
Posts: 19
Reputation:
Solved Threads: 0
I'm using the following function to modify tags used for mouseover text: It is being used on the following web page: http://huntsvillecarscene.smugmug.com/gallery/1144571
For some reason, the regexp.replace is not working. There is a test clause in there to help me diagnose some of what's going on.
I'm not a Javascript programmer. I only have a limited background in C. I've been working on this for 2 days and am frustrated out of my mind.
Any assistance appreciated.
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
function delHoverX() { re = /(\bdsc00001\b)/i; imgTags = document.getElementsByTagName("img"); for (i=0; i<imgTags.length; i++) { if (re.test(imgTags[i].title)) { origTitle = imgTags[i].title; origAlt = imgTags[i].alt; imgTags[i].title.replace(re, "$1"); imgTags[i].alt.replace(re, "$1"); if (origTitle == imgTags[i].title && origAlt == imgTags[i].alt) { imgTags[i].title = "same"; imgTags[i].alt = "same"; } } else { imgTags[i].title = ""; imgTags[i].alt = ""; } } }
For some reason, the regexp.replace is not working. There is a test clause in there to help me diagnose some of what's going on.
I'm not a Javascript programmer. I only have a limited background in C. I've been working on this for 2 days and am frustrated out of my mind.
Any assistance appreciated.
![]() |
Similar Threads
- Stuck Key Error (Viruses, Spyware and other Nasties)
- javascript works in IE but not working in firefox (JavaScript / DHTML / AJAX)
- Dell Inspiron 1100 - Primary Hard Disk Srive 0 Not Found (Storage)
- The C:\WINDOWS\winsock\csrss.exe application cannot be run in Win32 Mode (Windows NT / 2000 / XP)
- gateway laptop (Storage)
- Sorting Strings (Java)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: HELP! With Javascripts Pop-Up Window
- Next Thread: No toolbars in window
Views: 3816 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for JavaScript / DHTML / AJAX
ajax ajaxexample ajaxjspservlets array autoplay blackjack browser captcha captchaformproblem cart child class close codes date debugger dependent developer disablefirebug dom editor element embed engine enter events explorer ext file firefox flash focus form forms game gears getselection google gxt hiddenvalue highlightedword hint html ie7 ie8 iframe java javascript javascripthelp2020 jquery jsf jsp jump libcurl maps margin marquee masterpage math media menu object onerror onmouseoutdivproblem onreadystatechange parent passing paypal pdf php player position post programming prototype rated redirect safari scale scriptlets scroll search security size software solutions sources star stars stretch synchronous toggle tweet unicode variables web webkit webservice window \n






