|
Why do you want to? There are numerous reasons why they are implemented
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
|
So, I have worked out a lot of my IE7 woes. I have one more. I have a page full of imgs. js is called when the image gets or loses focus:
function showBorder(element)
{
element.style.border = "5 solid rgb(0,0,0)";
element.style.borderTopStyle = "none";
element.style.borderBottomStyle = "none";
element.style.cursor = "pointer";
element.style.cursor = "hand";
}
function hideBorder(element)
{
element.style.border = "";
element.style.cursor = "default";
}
This code, specifically, any change to element.style.border, causes the whole page to disappear. Even if I comment out 'showBorder', hideBorder reports that element.style.border has a value of "", and when I set it to "" again, the page disappears. Any help appreciated.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Hi.
Please post your HTML and please use <pre></pre>
|
|
|
|
|
The html is an img tag, there's nothing of relevance there.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Try this :
function showBorder(id)
{
var element = window.document.getElementById(id);
element.style.border = "solid 5px #000000";
element.style.cursor = "pointer";
element.style.cursor = "hand";
}
<img src="img.jpg" id="img" onmouseover="showBorder('img')" />
Although you can use CSS :
img:hover{
border: 1px solid #CC0033;
cursor: pointer;
}
|
|
|
|
|
Well.. I don't know - hate to be contrary but I like IE7...
anyways...
When you're using Javascript to set your css styles, you must sstill assign valid CSS on the right hand side.
border = ""
equivalent to setting
border:;
in a CSS file is not valid. Try
element.style.border = "none";
if that's what you are trying to achieve.
Similarly, I would re-write
element.style.border = "5 solid rgb(0,0,0)";
as
element.style.border = "solid 5px #000000";
May help...
|
|
|
|
|
borderTopStyle
borderBottomStyle
?? never heard of 'em!
Use
borderTop
borderBottom
instead - and similar considerations asin previous post...
|
|
|
|
|
OK, I will try that, but however I ended up at this code, it does work in IE6 and I believe in FF.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Phil Uribe wrote: element.style.border = "none";
Yeah, I was doing that to start with. I moved to "" because that's what was there already, and I wanted to see if setting it to what it was already, still makes the whole page disappear.
Phil Uribe wrote: element.style.border = "solid 5px #000000";
Thanks - I tried that, the page still disappears when the code is run.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Well, not exactly sure what you're trying to achieve, but this works fien for me ion bioth IE7 and FF
<html>
<head>
<title></title>
<script langauge="javascript">
function showBorder(element) {
element.style.borderTop = "solid 5px #ff0000";
element.style.borderBottom = "solid 5px #ff0000";
element.style.cursor = "hand";
}
function hideBorder(element) {
element.style.border = "none";
element.style.cursor = "pointer";
}
</script>
</head>
<body >
<img src="img.jpg" id="img" onmouseover="showBorder(this)" onmouseout="hideBorder(this)" >
</body>
</html>
|
|
|
|
|
If possible, you are better of putting all this kind of stuff in your CSS file to start with and avoiding Javascript altogether...
|
|
|
|
|
Christian Graus wrote: element.style.border = "5 solid rgb(0,0,0)";
You have forgotten the unit on the border width. Although it works in IE with this faulty setting, any other browser will ignore it.
element.style.border = "5x solid rgb(0,0,0)";
Christian Graus wrote: element.style.cursor = "pointer";
element.style.cursor = "hand";
Setting the same property twice doesn't make it any better. The standard value is 'pointer', and that's what you should use. The non-standard 'hand' value is only recognised by Internet Explorer.
Christian Graus wrote: This code, specifically, any change to element.style.border, causes the whole page to disappear.
That suggests that there is something wrong with the html code. Have you verified the code?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi ,
I have a textbox where user is allowed to enter some text value. Now the problem is when user is entering "
|
|
|
|
|
You need to escape the contents of the input box. I'm not sure which language you are using but, for example, in PHP you would use the htmlspecialchars function:
<input type="text" value="<?php echo htmlspecialchars ($variable) ?>" />
There will be something similar in most other systems.
|
|
|
|
|
My web host automatically forwards 404 errors to a page that I choose. So let's say a nonexistent page is /ihasabucket.htm and my web host forwards it to /404.htm; how do I display the url ihasabucket.htm to the user?
Thanks
|
|
|
|
|
Your best solution would be not to automatically redirect 404 errors and then handle it properly on the URL that was requested. If you have no choice but to redirect then you could try accessing the referrer variable (access to which is dependant on your language - in PHP try $_SERVER) to discover where the page was referred from.
|
|
|
|
|
Hmm... I can get the referrer in javascript using document.referrer but it displays the page that the link came from (eg index.htm links to ihasabucket.htm) then all we see is index.htm
I think I might talk to my web host about letting my .htaccess file handle 404 errors. Thanks anyway!
|
|
|
|
|
Hi
How can we prevent Search Engines Caching or indexing on our websites?
Thank you.
|
|
|
|
|
a robots.txt file.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Thank you.
But I couldn't figure out.
Please explain more.
|
|
|
|
|
I'm sorry, I thought you may live in a country that has google. A robots.txt file lists the directories that a search engine should ignore and is placed in the root.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
|
|
So, I have to update my company website. I worked on it extensively while I was away. The new design calls for two frames, with all the links in the top frame, which then cause pages to appear in the bottom one. So, I have a method like this:
function
navigateFrame2(path, id)
{
if (parent.frames.length > 1)
{
clearStyles();
var el = document.getElementById(id);
if (el)
{
el.style.fontWeight =
"bold";
}
// parent.frames[0].location = "header.aspx";
parent.frames[1].location = path;
}
return false;
}
and links like this:
<
a class="menuLink" runat="server" href="javascript:void(0);" onclick="javascript:navigateFrame2('iPhone.aspx', iPhoneId);" ID="iphone" style="padding 5 0 5" >iPhone/iPod</a> |
This all worked great in IE6. In IE7, a couple of my pages come up fine, but the rest either do not come up, come up after I've clicked the link a few times ( only one page does this ), or appear only to disappear again in a split second. When I right click on the lower frame, and view source, the source is there, and if I save it as a html file, IE7 can view it. If I open two pages in two tabs, then if I go to a link in my page, go to the other tab, then go to another program, and back, and click the tab, the page is shown. So, it appears to be some sort of rendering bug ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|