Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replace throwing error with <> symbols 1

Status
Not open for further replies.

checkai

Programmer
Jan 17, 2003
1,629
US
I'd like my link to show <> symbols on hover and then remove them on mouse out...

here's what I have so far.

Code:
onmouseover="this.innerText= '< ' + this.innerText + ' >';"
Code:
onmouseout="this.innerText = replace(' >', replace('< ',this.innerText));"

"...your mom goes to college..."
 
that did not replace anything...

"...your mom goes to college..."
 
worked perfectly for me:

Code:
<div onmouseover="this.innerText= '< ' + this.innerText + ' >';"
     onmouseout="this.innerText = this.innerText.replace(/\<|\>/g, '');"
>cory</div>

show your code, we can't guess what you're doing.



*cLFlaVA
----------------------------
[tt]"quote goes here"[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
You are right, sorry about that! Is there a way then to get rid of the space that is after the symbol?

'< ' I'd like to have the space there, but then remove it on mouseout.

"...your mom goes to college..."
 
Code:
this.innerText = this.innerText.replace(/\<\s|\s\>/g, '');

if there may ever be more than one space, this would need to be modified. otherwise, should work fine. let me know.



*cLFlaVA
----------------------------
[tt]"quote goes here"[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Awesome, thanks!

"...your mom goes to college..."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top