0

I currently have the following code:

<script type="text/javascript" src="http://www.usuarios-online.com/usuarios.php?v=www.bitchimblonde.tumblr.com"></script> <a href="http://www.usuarios-online.com/en/">mermaids in paradise. </a>

I know little to nothing about Java and coding, but want to disable the click through link to the stats page. 'http://www.usuarios-online.com/usuarios.php?'

Can anybody help me at all? I've heard about javascript:void(0) but have no idea how to implement it into my code.

5
  • What does this have to do with Java?? Commented Mar 27, 2012 at 0:26
  • Is there a page this is working on? I can't really tell what the external js is doing to your poor dom without seeing it. Commented Mar 27, 2012 at 0:28
  • 1
    @HovercraftFullOfEels you're right bad tag. Kevin, java is an entirely different language that has nothing to do with this other than they both follow ECMA script standards. Commented Mar 27, 2012 at 0:29
  • @FlavorScape, here's the link to the site: summers-in-cali.tumblr.com Commented Mar 27, 2012 at 0:41
  • @KevinSkittlesNan Java and JavaScript are two different languages, they just have similar names. Commented Mar 27, 2012 at 0:44

4 Answers 4

1

Replace the a node by the text node in the a element:

myANode.parentNode.replaceChild(myANode.firstChild, myANode);

This makes the a element to an ordinary text node.

Sign up to request clarification or add additional context in comments.

Comments

0
<a href="javascript:void(0)">Useless Link</a>

6 Comments

Doesn't work as the script fetches data from: usuarios-online.com/usuarios.php?v=www.bitchimblonde.tumblr.com. I don't know how to implement <a href= into this.
Also, do you konw anything about 'return false'?
I want this link: usuarios-online.com/usuarios.php?v=www.bitchimblonde.tumblr.com to be 'unclickable'. However, the script fetches data from the link (how many users online). Is it possible to disable click-through?
Okay. So how/where do I put javascript:void(0) into this code? <script type="text/javascript" src="usuarios-online.com/…> <a href="usuarios-online.com/en/">mermaids in paradise. </a>
You only have 1 link in that code, the other one just includes a javascript file in your html code. So to make that disabled, where it says <a href="usuarios-online.com/en/">mermaids in paradise.</a> change that to <a href="javascript:void(0);">mermaids in paradise.</a>
|
0

With jquery:

// this prevents the code to execute before the DOM Tree is ready
$(document).ready(function(){

    // when clicking #mylink, execute this function
    $('#mylink').click(function(e){
        e.preventDefault();
    });
});

With #mylink being the element's id attribute. You can download jquery here and call it with something like:

<script type="text/javascript" src="js/jquery.js"></script>

assuming you named your jquery file: jquery.js and put it in a folder named js.

Comments

0

All you have to do is change the href property to a value you are happy with, e.g.

aLink.href = '';

To do every link in the document:

var links = document.links;
for (var i=0, iLen=links.length; i<iLen; i++) {
  links[i].href = '';
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.