/    Sign up×
Community /Pin to ProfileBookmark

URGENT!! No underline on javascript link

Hey everyone!

I’m very, very new to javascript. Here is my script in html:

<script language=javascript>
<!–
var mylink = “contact.htm”
var linkname = “CONTACT US”

document.write(“<a href=” + mylink + “>”)
document.write(linkname + “</a>”)
this.style.textDecoration=’none’;
//–>
</script>

I know you are all saying use CSS but I need to make this specific link spam safe. My problem is that I don’t want the link to be underlined. The last line of the code doesn’t work at all. Can anyone please help me??? This has to be in javascript, though. I have other links that need to be underlined so changing the html properties won’t work.

Thanks,
Karen

to post a comment
JavaScript

8 Comments(s)

Copy linkTweet thisAlerts:
@deep_dhyaniMar 20.2006 — <i>
</i>&lt;html&gt;
&lt;head&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;script language="javascript"&gt;
&lt;!--
var mylink = "contact.htm"
var linkname = "CONTACT US"
document.write("&lt;a href=" + mylink + " style="text-decoration:none;"&gt;")
document.write(linkname + "&lt;/a&gt;")
//--&gt;
&lt;/script&gt;

&lt;/body&gt;
&lt;/html&gt;

Copy linkTweet thisAlerts:
@JS_FreakauthorMar 20.2006 — PERFECT!! Thank you so much!
Copy linkTweet thisAlerts:
@JS_FreakauthorMar 20.2006 — Just another question on the above. I've modified it to this:

document.write("<a href=" + mylink + " style="color:#000000; + style="text-decoration:none;">")

document.write(linkname + "</a>")

I basically want to change the colour of the link as well. I doesn't work though. The underline bit does but as soon as I specify a colour, the underline come back. Any advice?


Karen
Copy linkTweet thisAlerts:
@deep_dhyaniMar 20.2006 — a tag takes only one style attribute, so you can do like that:

<i>
</i>&lt;script language=javascript&gt;
&lt;!--
var mylink = "contact.htm"
var linkname = "CONTACT US"
document.write("&lt;a href=" + mylink + " style='text-decoration:none;color:#000000'&gt;")
document.write(linkname + "&lt;/a&gt;")

//--&gt;
&lt;/script&gt;
Copy linkTweet thisAlerts:
@OverkillMar 20.2006 — And if you want to be super cool:
&lt;script [color=blue]type="text/javascript"[/color]&gt;
&lt;!--
var mylink = "contact.htm"[color=red];[/color]
var linkname = "CONTACT US"[color=red];[/color]
document.write("&lt;a href=" + mylink + " style=[color=blue]"[/color]text-decoration:none;color:[color=blue]#000"[/color]&gt;")[color=red];[/color]
document.write(linkname + "&lt;/a&gt;")[color=red];[/color]
//--&gt;
&lt;/script&gt;
Copy linkTweet thisAlerts:
@JS_FreakauthorMar 20.2006 — Cool! Thanks guys. I really appreciate it!!
Copy linkTweet thisAlerts:
@JS_FreakauthorMar 20.2006 — Sorry! One more question then I'm done. How can I place this javascript link on an image. I know that this - <img src="../images/links_5.jpg" alt="Feedback" width="225" height="76" border="0"> - has be written in. Any ideas?
Copy linkTweet thisAlerts:
@OverkillMar 20.2006 — &lt;script type="text/javascript"&gt;
&lt;!--
var mylink = "contact.htm";
var linkname = "CONTACT US";
document.write("&lt;a href=" + mylink + " style="text-decoration:none;color:#000"&gt;");
document.write([color=blue]"&lt;img src="../images/links_5.jpg" alt="Feedback" width="225" height="76" border="0"&gt;[/color]&lt;/a&gt;");
//--&gt;
&lt;/script&gt;
×

Success!

Help @JS_Freak spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...