2 I have problem on firefox, image control never displays image in firefox.I have mentioned the code below.Can any one send me suggestions to solve these issues
<img id="image" height="200" width="200" alt="Hi" src="URL">
It works in Safari 3.1.2 on Mac OS 10.5
This is not the cross-browser way of opening a new window.
Here is the solution.
onclick="window.open(this.href,'_blank','height=500,width=500,status=no, toolbar=no,menubar=no,location=no');return false"
>Link TEXT or IMAGE HERE</a>
Portable meaning you can use the same code for different situations, although it's bad enough that the code referred to is embedded inline. By replacing the explicit url with this.href he can just copy this on other elements and not retype the same link over and over.
Portable means cross-broser.
I never thought of the this.href solution. Have to test how it is handled by the different browsers. If they all accept it, this is GREAT.
There are also a couple of other changes you can make that will make the onclick code more portable so that you don't need to change it if you have multiple links that you want to use it with.
He clearly mentions what he means by portable (which I bolded and underlined for you). What he has suggested does not make any difference cross-browser wise, and all modern user agents would support the legacy DOM property href on the current HTMLElement.
All modern? What about older, not everybody surfs with the last browser?
For example IE 8 is on the way, and ppl still surf with IE 5.5.
It does support this.href, since its a legacy dom property as mentioned. Are you not able to grab a copy and test out for yourself?
This is what I mentioned in a first place. If tests show it works, then it is good.
Actually you are just speaking for the sake of it, not reading the posts on the first place.
You shouldn't need to test 'this.href' on browsers, as 95%+ of them support this, since these are LEGACY DOM 0 PROPERTIES which have been supported for YEARS and YEARS.
I think this is off topic. Thank you so far for your replies.
Thank you once again.
Try the following out on a Netscape 2.0 browser.
<a href="somelink.html" onclick="alert(this.href)">Test</a>
This topic is now closed. New replies are no longer allowed.