Hi folks,
This is my first post.
I have an app working perfectly under IE6 but failing in IE7 or FireFox. I believe something wrong with the CSS. I've attached my code below. The whole idea is to attach a dropdown menu to a textbox. In FF or IE7, the dropdown menu will be kind of created but on a wrong position and with no color(or you can say the style is not attached).
To have more background, please refer to "Ajax in Action" by Manning. I am using one of the chapter for TypeAhead, kind of Google suggestion.
Thank you.
[html]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d" >
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server" >
<title >Welcome</title >
<style type="text/css" >
<!--
.style3 {
font-size: 72px;
color: #0000FF;
}
.style4 {color: #FF0000}
.style5 {color: #FFCC00}
.style6 {color: #006633}
.style7 {font-size: 100px}
.style8 {font-size: x-small}
-- >
</style >
<LINK href="style.css " type="text/css" rel="stylesheet " >
<script src="net.js" type="text/javascript"></script>
<script language="JavaS cript">
window.onload = function(){
var elemSpan = document.create Element("span") ;
elemSpan.id = "spanOutput ";
elemSpan.classN ame = "spanTextDropdo wn";
//document.body.a ppendChild(elem Span);
document.body.a ppendChild(elem Span);
.........
function BuildList(theTe xt){
SetElementPosit ion(theTextBox);
.......
function SetElementPosit ion(theTextBoxInt) {
var selectedPosX = 0;
var selectedPosY = 0;
var theElement = theTextBoxInt;
if (!theElement) return;
var theElemHeight = theElement.offs etHeight;
var theElemWidth = theElement.offs etWidth;
while(theElemen t != null){
selectedPosX += theElement.offs etLeft;
selectedPosY += theElement.offs etTop;
theElement = theElement.offs etParent;
}
xPosElement = document.getEle mentById("spanO utput");
//debugger;
xPosElement.sty le.left = selectedPosX + 'px';
//xPosElement.sty le.left = "62px";
if(theTextBoxIn t.obj.matchText BoxWidth)
xPosElement.sty le.width = theElemWidth + 'px';
//xPosElement.sty le.width = "473px";
xPosElement.sty le.top = selectedPosY + theElemHeight + 'px';
//xPosElement.sty le.top = "224px";
xPosElement.sty le.display = 'block';
//debugger;
if(theTextBoxIn t.obj.useTimeou t){
xPosElement.onm ouseout = StartTimeout;
xPosElement.onm ouseover = EraseTimeout;
}
else{
xPosElement.onm ouseout = null;
xPosElement.onm ouseover = null;
}
}
[/html]
[code=css]
style.css:
body, table, div, TR, td
{
font: 8pt verdana;
color: black;
background-color: white;
}
p,th { font-size: 9px; font-weight:bold; color: #666666; line-height: 16px;}
A
{
color:black;
}
a:link { font-size: 9px; font-weight:bold; text-decoration: underline; color: green;}
.span.spanTextD ropdown{
position: absolute;
top: 0px;
left: 0px;
width: 150px;
z-index: 101;
background-color: #C0C0C0;
border: 1px solid #000000;
padding-left: 0px;
overflow: visible;
display: none;
}
.span.spanMatch Text
{
text-decoration: underline;
font-weight: bold;
}
.span.spanNorma lElement
{
background: #ccffff;
}
.span.spanHighE lement
{
background: #ffcccc;
color: red;
cursor: pointer;
}
.span.noMatchDa ta
{
font-weight: bold;
color: #0000FF;
}[/code]
This is my first post.
I have an app working perfectly under IE6 but failing in IE7 or FireFox. I believe something wrong with the CSS. I've attached my code below. The whole idea is to attach a dropdown menu to a textbox. In FF or IE7, the dropdown menu will be kind of created but on a wrong position and with no color(or you can say the style is not attached).
To have more background, please refer to "Ajax in Action" by Manning. I am using one of the chapter for TypeAhead, kind of Google suggestion.
Thank you.
Code:
[B]Default.aspx[/B] <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" % >
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d" >
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server" >
<title >Welcome</title >
<style type="text/css" >
<!--
.style3 {
font-size: 72px;
color: #0000FF;
}
.style4 {color: #FF0000}
.style5 {color: #FFCC00}
.style6 {color: #006633}
.style7 {font-size: 100px}
.style8 {font-size: x-small}
-- >
</style >
<LINK href="style.css " type="text/css" rel="stylesheet " >
<script src="net.js" type="text/javascript"></script>
<script language="JavaS cript">
window.onload = function(){
var elemSpan = document.create Element("span") ;
elemSpan.id = "spanOutput ";
elemSpan.classN ame = "spanTextDropdo wn";
//document.body.a ppendChild(elem Span);
document.body.a ppendChild(elem Span);
.........
function BuildList(theTe xt){
SetElementPosit ion(theTextBox);
.......
function SetElementPosit ion(theTextBoxInt) {
var selectedPosX = 0;
var selectedPosY = 0;
var theElement = theTextBoxInt;
if (!theElement) return;
var theElemHeight = theElement.offs etHeight;
var theElemWidth = theElement.offs etWidth;
while(theElemen t != null){
selectedPosX += theElement.offs etLeft;
selectedPosY += theElement.offs etTop;
theElement = theElement.offs etParent;
}
xPosElement = document.getEle mentById("spanO utput");
//debugger;
xPosElement.sty le.left = selectedPosX + 'px';
//xPosElement.sty le.left = "62px";
if(theTextBoxIn t.obj.matchText BoxWidth)
xPosElement.sty le.width = theElemWidth + 'px';
//xPosElement.sty le.width = "473px";
xPosElement.sty le.top = selectedPosY + theElemHeight + 'px';
//xPosElement.sty le.top = "224px";
xPosElement.sty le.display = 'block';
//debugger;
if(theTextBoxIn t.obj.useTimeou t){
xPosElement.onm ouseout = StartTimeout;
xPosElement.onm ouseover = EraseTimeout;
}
else{
xPosElement.onm ouseout = null;
xPosElement.onm ouseover = null;
}
}
[/html]
[code=css]
style.css:
body, table, div, TR, td
{
font: 8pt verdana;
color: black;
background-color: white;
}
p,th { font-size: 9px; font-weight:bold; color: #666666; line-height: 16px;}
A
{
color:black;
}
a:link { font-size: 9px; font-weight:bold; text-decoration: underline; color: green;}
.span.spanTextD ropdown{
position: absolute;
top: 0px;
left: 0px;
width: 150px;
z-index: 101;
background-color: #C0C0C0;
border: 1px solid #000000;
padding-left: 0px;
overflow: visible;
display: none;
}
.span.spanMatch Text
{
text-decoration: underline;
font-weight: bold;
}
.span.spanNorma lElement
{
background: #ccffff;
}
.span.spanHighE lement
{
background: #ffcccc;
color: red;
cursor: pointer;
}
.span.noMatchDa ta
{
font-weight: bold;
color: #0000FF;
}[/code]
Comment