Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-27-2009, 04:58 PM   PM User | #1
tcrisera
New to the CF scene

 
Join Date: Jan 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
tcrisera is an unknown quantity at this point
Showing DIV on SELECT OPTION mouseover in IE

I'm trying to display a DIV w/ detail info that corresponds to a dropdown list option. I'm trying to place it at a set location on the right side of the page. The following code snippets work fine in Firefox, but not in IE 6.

<div id="divVendorDetail_1" style="border: solid 1px #214273;position: absolute;display:none;background-color: #ffffff;z-index: 200;">
<table border="0" cellpadding="2" cellspacing="0" width="350">
...
</div>

<select name="cboVendorList" onchange="submitFindVendor('VendorAdministration')" ">
<option value="1" onmouseover="showVendorDetails('divVendorDetail_1')"
onmouseout="hideVendorDetails('divVendorDetail_1')"></option>

function showVendorDetails(divName) {
if(divName.length < 1) { return; }

document.getElementById(divName).style.visibility = 'visible';
document.getElementById(divName).style.display = 'block';

var cX = 0; var cY = 300;

if (window.innerWidth) { //if browser supports window.innerWidth
cX = window.innerWidth - 400;

}
else
if (document.all) { //else if browser supports document.all (IE 4+)
cX = document.body.clientWidth - 400;

}

document.getElementById(divName).style.left = (cX) + "px";
document.getElementById(divName).style.top = (cY) + "px";

}


Tried some alerts, but didn't even seem to work at the top of the function in IE6. Any help appreciated, javascript not my longsuit, especially cross browser issues.

Thanks, TC
tcrisera is offline   Reply With Quote
Old 01-27-2009, 05:02 PM   PM User | #2
angst
Senior Coder

 
angst's Avatar
 
Join Date: Apr 2004
Location: Toronto, Ontario
Posts: 2,112
Thanks: 15
Thanked 122 Times in 122 Posts
angst is on a distinguished road
where are you getting the 'window' object from?

also just a tip, if you have a one liner IF statement,
like
PHP Code:
 if(divName.length 1) { return; } 
you don't need the addition brackets.
PHP Code:
 if(divName.length 1) return; 
angst is offline   Reply With Quote
Old 01-27-2009, 06:22 PM   PM User | #3
tcrisera
New to the CF scene

 
Join Date: Jan 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
tcrisera is an unknown quantity at this point
Sorry, I assumed window object was always available from context or something. Seems to be, because this is the Firefox part that works. (I got the code from an online example of testing for browser type and several examples I saw had the same if conditions.) Also, I can debug in FF with Firebug pretty easily but haven't been able to step into the code from IE. I don't think I even get into the method in IE because I put an alert as the first line.

I do see a page load warning in IE that says invalid character at Line 2 Char 1, but all that is there is the <head> tag.

Thanks for the tip anyway, but I'm a Java programmer, so I realized that. That first line was a paste from an example.

Thank, TC
tcrisera is offline   Reply With Quote
Old 01-27-2009, 06:28 PM   PM User | #4
angst
Senior Coder

 
angst's Avatar
 
Join Date: Apr 2004
Location: Toronto, Ontario
Posts: 2,112
Thanks: 15
Thanked 122 Times in 122 Posts
angst is on a distinguished road
ah ok, have a look here: http://www.howtocreate.co.uk/tutoria.../browserwindow

I think this explains some of your issue
angst is offline   Reply With Quote
Old 01-27-2009, 08:37 PM   PM User | #5
tcrisera
New to the CF scene

 
Join Date: Jan 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
tcrisera is an unknown quantity at this point
Alas, that wasn't it. I kept looking around and found that with IE6 you can't get the mouseover event of a select option. Haven't been able to find a workaround to that.

Thanks anyway, TC
tcrisera is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:28 AM.


Advertisement
Log in to turn off these ads.