|
When building a link that has the sole purpose to run javascript, is it better to:
<a href="#" onclick="myJsFunc();">Link</a>
Or
<a href="javascript:void(0)" onclick="myJsFunc();">Link</a>
Started by 2cBGj7vsfp on
, 26 posts
by 26 people.
Answer Snippets (Read the full thread at stackoverflow):
Otherwise as fallback for non-....
<a href="#" onclick="myJsFunc the href points to a page that performs the same action as the javascript being executed.
To prevent the click event from firing if the JavaScript executes.
|
|
I have a RegEx which nicely finds the href's in a URL:
<[aA][^>]*? href=[\"'](?<url>[^\"]+?)[\"'][^>]*?>
However, I want it to NOT find any href that contains the text, 'javascript:' in it.
The reason is that I sometimes need to mod ...
Started by BahaiResearch.com on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Simple excluding javascript word dot't provide you safety at all..
Look at ha.ckers.org article.
A word javascript can be written in other ways.
It a lot less grief.
|
|
I want to run a simple JavaScript function on a click, that is NOT a redirect. Is there any difference or benefit between putting the JavaScript call in <A HREF="javascript:my_function();window.print()" ></A> vs. putting it in the onclick ...
Answer Snippets (Read the full thread at stackoverflow):
Place a valid URL in the href field (commonly '#') for fallback for those who do not have javascriptPutting the onclick....
I usually don't.
javascript-in-an
Personally, I find putting javascript calls in the HREF tag annoying.
|
Ask your Facebook Friends
|
HI ,
<script language="javascript" type="text/javascript"> var scrt_var = 10; </script> < html > this is a <a href ="2.html & Key= scrt_var">Link </a> </htm>
I just want to sent the javascript variable to link ( url...
Started by joe on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
javascript" type="text/javascript"> var scrt_var = 10; </script> <a href="2.html" onclick;script type="text\javascript"> var location = "http://"; document.write('<a href="' + location() { location....
|
|
We want to allow "normal" href links to other webpages, but we don't want to allow anyone to sneak in client-side scripting.
Is searching for "javascript:" within the HREF and onclick/onmouseover/etc. events good enough? Or are there other things to check...
Started by Larsenal on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
Background: url(javascript:...) or width:expression about preventing cross-site scripting which would cover a bit more than simply preventing javascript from being inserted into an....
Thirdly you need to check for CSS based script, e.g .
|
|
I've recently been bitten by the javascript:void(null); bug in my hrefs when applied to images.
In my version of Safari (4.0.3 in Leopard PPC) when I apply an href of javascript:void(null); around an image, the image completely disappears from the layout...
Started by Richard Testani on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Where="doSomething();" class....
A href="javascript:"><img src=""/></a>
That shouldn't cause a problem on any browser is
<a href="non_javascript_alternative.html" onclick="doSomething(); return false;">
...
|
|
Hi, I need to call a Javascript function from an a element.. something like this:
href='javascript:myjavascriptfunction();' . I need the Javascript function to get the values from a couple of datepicker controls, build and urlencode a querystring and ...
Started by danielea on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
That is possible:
var link it is for you is you're telling... .
At the minimum, do href="javascript:void(0)" and then onclick to get the A element in JavaScript and meddle with its HREF.
With an onclick that degrades gracefully.
|
|
I am using JQuery. I call a javascript function with next html:
<li><span><a href="javascript:uncheckEl('tagVO-$id')">$tagname</a></span></li>
I would like to remove the li element and i thought this would be easy with...
Started by Sergio del Amo on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Parent().parent().hide(); // this should be your <li> }
And your link:
<a href="javascript.
|
|
Hi everyone, I have a livesearch script that i need to populate my html menu with information.
i have a menu how looks something like this:
<a href="?page=page&id=">Menu item</a>
what i'm looking for is a piece of code that would do this to...
Started by Filip Palm on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Lt;a href="?page=page&id=" id="link1">Menu item</a> <script type='text/javascript'> var myidtoinsert = 5; document.getElementById("link1").href += myidtoinsert; </script>
Give your a tag an id and then just use....
|
|
I am writing a screen scraper script in python with module 'mechanize' and I would like to use the mechanize.click_link() method on a link that has javascript:__doPostBack in href. I believe the page I am trying to parse is using AJAX.
Note: mech is the...
Started by nunos on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Xa1gina seguinte: 2'), ('href', "javascript:__doPostBack('ctl00$ContentPlaceHolder1$Pager1$lnkNextI don't think mechanize supports Javascript; to scrape pages which intrinsically rely on Javascript/ConsultasDistribuicao.aspx....
|