Menu Menu DaniWeb
Log In Sign Up
  • Read
  • Contribute
  1. Home
  2. Programming Forum
  3. Web Development Forum
  4. Code Snippet Repository
  5. Reusable Code Snippet

page links destroy

9 Years Ago Troy III 0 Tallied Votes 158 Views Share

With this Spartan, we can destructively disable all the links on the page.
(Or whatever link collection we feed the Fn.arg.)

backlinks disable javascript
function destroyLinks(a){
        while( a[0] ){ a[0].outerHTML = a[0].innerHTML };
        }

usage:

    destroyLinks( document.links );
About the Author
Member Avatar
Troy III 272 Posting Pro
Member Avatar
stbuchok
9 Years Ago

Is it really safe to modify an array while looping through that array? Isn't there a chance that can turn into an infinite loop? If no, then nice, otherwise I prefer a for loop (personal choice).

Member Avatar
Troy III 272 Posting Pro
9 Years Ago

Perfectly safe.
A DOM Collection, is not an Array.
Inerently -perfectly faster!

Edited 9 Years Ago by Troy III
Member Avatar
Troy3
9 Years Ago

On behalf of Troy III:
"Have I been silently banned my Queen -
And why did my code-snip, end up in a regular thread?"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.

Sign Up — It's Free!
Related Topics
  • Member Avatar how to disable unselected check box 2
  • Member Avatar Can my dropdown menu produce a link instead of textbox? 2
  • Member Avatar Change Array key to value 8
  • Member Avatar Send Ajax request through link 5
  • Member Avatar Add links in EasySlide images (JavaScript)? 0
  • Member Avatar How to create tabs using jsp? 3
  • Member Avatar Javascript not working as planned 1
  • Member Avatar XML Parse using JavaScript to HTML 0
  • Member Avatar open links in parent window (from child)? 1
  • Member Avatar JavaScript and British Summer Time 6
  • Member Avatar Pass parameter through js, to AJAX, to php page. 2
  • Member Avatar jQuery getting text dynamic 4
  • Member Avatar how to load a page in a div tag 15
  • Member Avatar Load external javascript inside a specific div 17
  • Member Avatar Adding row isn;t working 2
  • Member Avatar enable/disable links at certain time 5
  • Member Avatar search engine in iframe result links to open in current window 2
  • Member Avatar help with using date/time 3
  • Member Avatar jQuery UI slider lag... and IE hates my javascript 2
  • Member Avatar Enable/disable multiple redirects based on cookie... 18
Not what you need?

Reach out to all the awesome people in our web development community by starting your own topic. We equally welcome both specific questions as well as open-ended discussions.

Start New Topic
Topics Feed
Reply to this Topic
This topic is old! No one has contributed to this discussion in over 9 years. Are you sure you have something valuable to add to revive the existing conversation? Consider starting a new topic instead. Otherwise, please be thoughtful, detailed and courteous, and adhere to our posting rules.
  • Edit
  • Preview
H1 H2
Broken Link

You're trying to visit a URL that doesn't currently exist on the web. Most likely, a member posted a link a long time ago to a web page that has since been removed. It's also possible that there was a typo when posting the URL. We redirect you to this notice instead of stripping out the link to preserve the integrity of the post.

Go Back to the Post Continue Anyways

Share Post

Insert Code Block

  • Forum Categories
  • Hardware/Software
  • Programming
  • Digital Media
  • Community Center
  • Latest Content
  • Newest Topics
  • Latest Topics
  • Latest Posts
  • Top Tags
  • Topics Feed
  • Social
  • Top Members
  • Community Functions
  • DaniWeb Premium
  • Newsletter Archive
  • Markdown Syntax
  • Community Rules
  • Developer APIs
  • Connect API
  • Forum API Docs
  • Legal
  • Terms of Service
  • Privacy Policy
  • FAQ
  • About Us
  • Advertise
  • Contact Us
© 2022 DaniWeb® LLC