href attribute

U

UKuser

Hi,

I'm having problems with this line:

document.getElementById('link'+1).setAttribute('href','#');
where link+1 is
<a href="map.html" target="searchX" id='link1'>Images</a>

Unlike many posts I've found on the web, I actually need to amend
link1 rather than create it. The reason being is that I've created
some tabs where if javascript is not turned on the search outputs to
an iframe hidden in the noscript tag. In FF I can strip the map.html
so it will work normally with JS turned on however IE still opens
map.html in a new window - showing its not stripping the href.

Any help would be great.

Thanks

A
 
S

SAM

UKuser a écrit :
Hi,

I'm having problems with this line:

document.getElementById('link'+1).setAttribute('href','#');

document.getElementById('link'+1).href = '#';
 
U

UKuser

UKuser a écrit :




document.getElementById('link'+1).href = '#';

Thanks for replying.

In the end I actually used removeAttribute - which I'd played with on
the target attribute but it didnt fully work - never tried it on href
and that fixed it.

Thanks again.

A
 
D

David Mark

Hi,

I'm having problems with this line:

document.getElementById('link'+1).setAttribute('href','#');
where link+1 is
<a href="map.html" target="searchX" id='link1'>Images</a>

Unlike many posts I've found on the web, I actually need to amend
link1 rather than create it. The reason being is that I've created
some tabs where if javascript is not turned on the search outputs to
an iframe hidden in the noscript tag. In FF I can strip the map.html
so it will work normally with JS turned on however IE still opens
map.html in a new window - showing its not stripping the href.

Why not just prevent the default action in the attached listener.
Changing the href is an odd way to go about this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top