Dynamic anchor href updating using javascript

The below script is removing ‘about:blank’ from all existing anchor hrefs

<script type=”text/javascript”>
var deadlinks=document.getElementsByTagName(“a”);
for (var i=0;i<deadlinks.length;i++){
if(deadlinks[i].href.substring(0,11) == ‘about:blank’)
{
var strlgnth = deadlinks[i].href.length;
var validurl = deadlinks[i].href.substring(11,strlgnth);
deadlinks[i].href = validurl;
}

}
</script>

HTML page layout center alignment

IE7 margin auto not working

Below is a code snippet that illustrates how the margin auto doesn’t work in IE7 as it does in pretty much every other modern browser.

<style type="text/css">
div{width: 50em; margin:0 auto; border:1px solid #CCCCCC}
</style>
.....
.....
<body>
<div>hello world</div>
</body>
....
...
In IE6, Firefox,opera and safari (well at least safari on windows) the above code will render a 50em wide DIV with a grey border in the middle of the window, regardless of the width of the window. However, in IE7 the DIV will be left aligned.

There is a quick, if a little unsatisfactory fix to this problem, see the revised <style> section below:

<style type="text/css">
body{text-align: center}
div{text-align: left; width: 50em; margin:0 auto; border:1px solid #CCCCCC}
</style>

This will now render a 50em wide DIV with a grey border in the middle of the window regardless of the width of the window in IE7 as well as in the other browsers.

Hi,

Can you pls send me the jquery for scroller functionality — as in Yahoo.com.

 

Thanks,

Vinay

Raise a post

Post your queries, tips and suggestions on UI related here, select the related category before post