How to disable JavaScript hyperlink?
Following on from your previous question , you can try this:
<!DOCTYPE html>
<html>
<head>
<title>Simple Demo</title>
</head>
<script type="text/javascript">
window.onload = function () {
document.getElementById('calendar').innerHTML =
document.getElementById('calendar_hidden').getElementsByTagName('a')[0].innerHTML;
};
</script>
<body>
<div id="calendar_hidden" style="display: none;">
<script src="http://www.parstools.net/calendar/?type=2"></script>
</div>
<div id="calendar" style="color: red;">
</div>
</body>
</html>
a source to share
If the link will always be the same and you know how to get that string into a variable, this should work:
str = str.replace( "<a href='http://www.ParsTools.com/'>", '' ).replace( '</a>', '' )
Edit in response to comment
It's not best practice, but .. Wrap the js include in a div:
<span id="whatever">
<script type="text/javascript" src="..."></script>
</span>
Then
<script type="text/javascript">
str = document.getElementById( 'whatever' ).innerHTML
str = str .... // what i said before
</script>
This solution doesn't require jQuery, which looks like something you don't want to use.
a source to share
If you put your script inside <div id="something">
, you can do the following:
var something = $('#something a');
something.replaceWith(something.contents());
if you include jQuery library.
See " How do I remove only a parent element and not its children in JavaScript? "
a source to share
I looked at the "script file" and I am very confused.
This is the entire content of the link: http://www.parstools.net/calendar/?type=2
document.write("<a href='http://www.ParsTools.com/'>1389/1/31</a>");
It is not a calendar at all.
Can you provide more information on using this script file?
a source to share