|
|||||||
| JavaScript JavaScript (not Java) Discussion and technical support, including AJAX and frameworks (JQuery, MooTools, Prototype...) |
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi.
I have a dynamically generated link on a page which I would like to change from being displayed as http://www.website.com to just www.website.com. The code is: HTML Code:
<a href="http://www.website.com" target="_blank" id="link">http://www.website.com</a> HTML Code:
<a href="http://www.website.com" target="_blank" id="link">www.website.com</a> |
|
#2
|
||||
|
||||
|
Easiest way would be to just replace the http:// with an empty string. Something like:
Code:
document.getElementById("link").innerHTML = document.getElementById("link").innerHTML.replace("http://","");
Last edited by iandevlin; 02-10-2010 at 03:45 AM. |
|
#3
|
|||
|
|||
|
Hi.
Works perfectly - thanks. Regards. |
|
#4
|
||||
|
||||
|
Welcome!
|
![]() |
| Bookmarks |
| Tags |
| innerhtml, replace |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|