Jump to content

banzemanga

Members
  • Content Count

    20
  • Joined

  • Last visited

Everything posted by banzemanga

  1. So, i have this table of three rows and three columns. I want that when i mouse over a cell, the entire row and column of that cell gets highlighted. And of course, i want a pure CSS solution. For the rows, it is easy because i can just implement the ":hover" selector over the <tr> tag. However, i can't implement over the ":hover" selector onto <colgroup> or <col> tags. That is becauase, all browsers implement such tag with no height nor width. Even if i try to add a width and height, the browser debugger will immediately show that such values will be reset to zero. <!DOCTYPE html><html><head> <title></title><style type="text/css"> table { border: 1px solid black; border-collapse: separate; } col:nth-child(2n+1) { width: 40px; background-color: violet; } col:hover { /*Doesn't work*/ background-color: aqua; } td { border: 1px solid black; text-align: center; width: 20px; height: 20px; } td:hover { background-color :red; /*Doesn't work*/ top: 0px; left: auto; height: 300%; /*position: fixed; /*breaks it completely*/ } tr { border: 1px solid black; } tr:hover { background-color: yellow; }</style></head><body><table> <colgroup> <col /> <col /> <col /> <col /> <col /> <col /> <col /> </colgroup> <tr> <td>1</td> <td>2</td> <td>3</td> </tr> <tr> <td>1</td> <td>2</td> <td>3</td> </tr> <tr> <td>1</td> <td>2</td> <td>3</td> </tr></table></body></html>
  2. Thanks for the reply. Too bad i can't use it the way i want it to.The idea was to make use of the inline-block property without having to insert it using CSS.I wanted inline-block tags for text formatting.
  3. I know there are some elements that are block elements by default like div, p tags.And there are other elements that are inline by default like span, a tags.Is there any tag that is inline-block by default?
  4. I am not sure what it is called in CSS but i think it has to do with inheritance.Let's say i have the following HTML table: <table id="styleme"> <tbody> <tr> <td>Hello</td> <td>World</td> </tr> </tbody></table> So i want my CSS to give a background color at the td tag on the table with id "styleme" and not the td tags of other tables.I know that if i want to specifically give a style to the table tag i could do: table#styleme { //whatever style } But i want to give style to my td tag without giving it a class name or id but going though the fact that table with the id is parent of the td tag i want to style..Edit: Never mind i found the solution. I have to include the tag-name of each cascaded element: table#styleme>tbody>tr>td { //the style for the td tag }
  5. I am writing a code that will generate the contents of a calendar into a table.For some reason, this code seems to work on all browsers except for IE which gives me an error of: Here is the piece of code:window.onload = constructor1;var cdate = new Date();var cday = cdate.getDate();var cmonth = cdate.getMonth();var cyear = cdate.getFullYear();var Month = cmonth;var Year = cyear;var calendar = document.createElement("table");calendar.id = "calendar";function constructor1(){ var doc = document; var txtNode = doc.createTextNode(""); //creates the skeleton of the calendar var tBody = doc.createElement("tbody"); var temp1 = tBody.insertRow(0); var temp2 = temp1.insertCell(0); temp2.appendChild(txtNode); for (var c=6; c--;) temp1.appendChild(temp2.cloneNode(true)); for (var r=5; r--;) tBody.appendChild(temp1.cloneNode(true)); //finds and assigns the date values on the calendar var cMonth = cmonth; var cYear = cyear; var pMonth, pYear; var daysCMonth = 32 - new Date(cYear, cMonth, 32).getDate(); var counter = [ 42 - new Date(cYear, cMonth, 1).getDay() - daysCMonth, daysCMonth, 32 - new Date((cMonth)?cYear:--cYear, (cMonth)?--cMonth:11, 32).getDate() ]; var i = 0; for (var r=6; r--;) { temp1 = tBody.rows[r]; for (var c=7; c--;) { temp2 = temp1.cells[c]; temp2.firstChild.nodeValue = counter[i]--; //<--- line of error if (i & 1); else temp2.id = "oMonth"; if (counter[i]); else ++i; } } //puts the calendar on the page calendar.appendChild(tBody); doc.body.appendChild(calendar);// doc = txtNode = tBody = cMonth = cYear = daysCMonth = temp1 = temp2 = i = null;} As far as i know, i haven't use code needs cross browser handling.Unless there is something i have been doing wrong. :)Edit: Nevermind, i found the source of error. It was caused by an IE bug when trying to clone text nodes. IE doesn't clone text nodes that has empty strings so i had to initialize the text node with some values. Really, IE is such a pain specially when it is not following standards.
  6. Well, in the DOM standard to select the text we use the .select() function. But the problem with this function is that it selects the entire text but i only want to make it select a portion.There is also the .setSelectionRange(start, end) but this is only for mozilla browsers including firefox. In other words, browsers like IE and Opera doesn't support it.To make it work in a IE browser, we need to create an activeX selection object, which has its own function.What i am wondering if there is any way to do it using DOM functions so that i don't have to write a function for each browser.What i have in mind is to send key codes to the value of the text container. For example, set the value of the textfield as hello + shift + left so that it will have hello with the letter o selected.Is is possible? And how do i send hey codes to the textfield value including things like press shift then left and then relesase shift?Thanks.
  7. Hello, i know how to manipulate html DOM using Javascript but i want to do it with Java now.The thing is that i don't know how to use the dom library in java.I see that the dom library are interfaces and i don't know very much about interfaces.When i try to implement an interface, it says that the class must be abstract and i don't want to make abstract classes.So what i need is just a basic setup for the main method.Probably the simplest is to append some text on the body of the page.From there i believe i should be able to take it and make it run.I have been looking for simple examples like this one everywhere but i don't find any.I have been looking for books too but i can't find any neither.So, any sugestions?Thanks.Edit: Let's say i want to do this Javascript code in java: window.onload = constructor;function constructor() { document.body.appendChild( document.createTextNode("Hello World!") );} Edit2: So far i managed to code it but unable to load the jar file. import java.io.IOException;import javax.xml.soap.SOAPElement;import javax.xml.soap.SOAPException;import org.w3c.dom.*;import org.w3c.dom.html.HTMLBodyElement;public class Main { static HTMLBodyElement body = new HTMLBodyElement() { public String getALink() { throw new UnsupportedOperationException("Not supported yet."); } public void setALink(String aLink) { throw new UnsupportedOperationException("Not supported yet."); } public String getBackground() { throw new UnsupportedOperationException("Not supported yet."); } public void setBackground(String background) { throw new UnsupportedOperationException("Not supported yet."); } public String getBgColor() { throw new UnsupportedOperationException("Not supported yet."); } public void setBgColor(String bgColor) { throw new UnsupportedOperationException("Not supported yet."); } public String getLink() { throw new UnsupportedOperationException("Not supported yet."); } public void setLink(String link) { throw new UnsupportedOperationException("Not supported yet."); } public String getText() { throw new UnsupportedOperationException("Not supported yet."); } public void setText(String text) { throw new UnsupportedOperationException("Not supported yet."); } public String getVLink() { throw new UnsupportedOperationException("Not supported yet."); } public void setVLink(String vLink) { throw new UnsupportedOperationException("Not supported yet."); } public String getId() { throw new UnsupportedOperationException("Not supported yet."); } public void setId(String id) { throw new UnsupportedOperationException("Not supported yet."); } public String getTitle() { throw new UnsupportedOperationException("Not supported yet."); } public void setTitle(String title) { throw new UnsupportedOperationException("Not supported yet."); } public String getLang() { throw new UnsupportedOperationException("Not supported yet."); } public void setLang(String lang) { throw new UnsupportedOperationException("Not supported yet."); } public String getDir() { throw new UnsupportedOperationException("Not supported yet."); } public void setDir(String dir) { throw new UnsupportedOperationException("Not supported yet."); } public String getClassName() { throw new UnsupportedOperationException("Not supported yet."); } public void setClassName(String className) { throw new UnsupportedOperationException("Not supported yet."); } public String getTagName() { throw new UnsupportedOperationException("Not supported yet."); } public String getAttribute(String name) { throw new UnsupportedOperationException("Not supported yet."); } public void setAttribute(String name, String value) throws DOMException { throw new UnsupportedOperationException("Not supported yet."); } public void removeAttribute(String name) throws DOMException { throw new UnsupportedOperationException("Not supported yet."); } public Attr getAttributeNode(String name) { throw new UnsupportedOperationException("Not supported yet."); } public Attr setAttributeNode(Attr newAttr) throws DOMException { throw new UnsupportedOperationException("Not supported yet."); } public Attr removeAttributeNode(Attr oldAttr) throws DOMException { throw new UnsupportedOperationException("Not supported yet."); } public NodeList getElementsByTagName(String name) { throw new UnsupportedOperationException("Not supported yet."); } public String getAttributeNS(String namespaceURI, String localName) throws DOMException { throw new UnsupportedOperationException("Not supported yet."); } public void setAttributeNS(String namespaceURI, String qualifiedName, String value) throws DOMException { throw new UnsupportedOperationException("Not supported yet."); } public void removeAttributeNS(String namespaceURI, String localName) throws DOMException { throw new UnsupportedOperationException("Not supported yet."); } public Attr getAttributeNodeNS(String namespaceURI, String localName) throws DOMException { throw new UnsupportedOperationException("Not supported yet."); } public Attr setAttributeNodeNS(Attr newAttr) throws DOMException { throw new UnsupportedOperationException("Not supported yet."); } public NodeList getElementsByTagNameNS(String namespaceURI, String localName) throws DOMException { throw new UnsupportedOperationException("Not supported yet."); } public boolean hasAttribute(String name) { throw new UnsupportedOperationException("Not supported yet."); } public boolean hasAttributeNS(String namespaceURI, String localName) throws DOMException { throw new UnsupportedOperationException("Not supported yet."); } public TypeInfo getSchemaTypeInfo() { throw new UnsupportedOperationException("Not supported yet."); } public void setIdAttribute(String name, boolean isId) throws DOMException { throw new UnsupportedOperationException("Not supported yet."); } public void setIdAttributeNS(String namespaceURI, String localName, boolean isId) throws DOMException { throw new UnsupportedOperationException("Not supported yet."); } public void setIdAttributeNode(Attr idAttr, boolean isId) throws DOMException { throw new UnsupportedOperationException("Not supported yet."); } public String getNodeName() { throw new UnsupportedOperationException("Not supported yet."); } public String getNodeValue() throws DOMException { throw new UnsupportedOperationException("Not supported yet."); } public void setNodeValue(String nodeValue) throws DOMException { throw new UnsupportedOperationException("Not supported yet."); } public short getNodeType() { throw new UnsupportedOperationException("Not supported yet."); } public Node getParentNode() { throw new UnsupportedOperationException("Not supported yet."); } public NodeList getChildNodes() { throw new UnsupportedOperationException("Not supported yet."); } public Node getFirstChild() { throw new UnsupportedOperationException("Not supported yet."); } public Node getLastChild() { throw new UnsupportedOperationException("Not supported yet."); } public Node getPreviousSibling() { throw new UnsupportedOperationException("Not supported yet."); } public Node getNextSibling() { throw new UnsupportedOperationException("Not supported yet."); } public NamedNodeMap getAttributes() { throw new UnsupportedOperationException("Not supported yet."); } public Document getOwnerDocument() { throw new UnsupportedOperationException("Not supported yet."); } public Node insertBefore(Node newChild, Node refChild) throws DOMException { throw new UnsupportedOperationException("Not supported yet."); } public Node replaceChild(Node newChild, Node oldChild) throws DOMException { throw new UnsupportedOperationException("Not supported yet."); } public Node removeChild(Node oldChild) throws DOMException { throw new UnsupportedOperationException("Not supported yet."); } public Node appendChild(Node newChild) throws DOMException { throw new UnsupportedOperationException("Not supported yet."); } public boolean hasChildNodes() { throw new UnsupportedOperationException("Not supported yet."); } public Node cloneNode(boolean deep) { throw new UnsupportedOperationException("Not supported yet."); } public void normalize() { throw new UnsupportedOperationException("Not supported yet."); } public boolean isSupported(String feature, String version) { throw new UnsupportedOperationException("Not supported yet."); } public String getNamespaceURI() { throw new UnsupportedOperationException("Not supported yet."); } public String getPrefix() { throw new UnsupportedOperationException("Not supported yet."); } public void setPrefix(String prefix) throws DOMException { throw new UnsupportedOperationException("Not supported yet."); } public String getLocalName() { throw new UnsupportedOperationException("Not supported yet."); } public boolean hasAttributes() { throw new UnsupportedOperationException("Not supported yet."); } public String getBaseURI() { throw new UnsupportedOperationException("Not supported yet."); } public short compareDocumentPosition(Node other) throws DOMException { throw new UnsupportedOperationException("Not supported yet."); } public String getTextContent() throws DOMException { throw new UnsupportedOperationException("Not supported yet."); } public void setTextContent(String textContent) throws DOMException { throw new UnsupportedOperationException("Not supported yet."); } public boolean isSameNode(Node other) { throw new UnsupportedOperationException("Not supported yet."); } public String lookupPrefix(String namespaceURI) { throw new UnsupportedOperationException("Not supported yet."); } public boolean isDefaultNamespace(String namespaceURI) { throw new UnsupportedOperationException("Not supported yet."); } public String lookupNamespaceURI(String prefix) { throw new UnsupportedOperationException("Not supported yet."); } public boolean isEqualNode(Node arg) { throw new UnsupportedOperationException("Not supported yet."); } public Object getFeature(String feature, String version) { throw new UnsupportedOperationException("Not supported yet."); } public Object setUserData(String key, Object data, UserDataHandler handler) { throw new UnsupportedOperationException("Not supported yet."); } public Object getUserData(String key) { throw new UnsupportedOperationException("Not supported yet."); } }; public static void main(String args[]) { body.setText("Hello World"); }} It is impossible to load an applet without an GUI?Edit3: Ok.... I learned something new. It seems that they were all empty interfaces that w3c provided and needed to be implemented by 'us' the programmers. I was able to find some libraries that implemented it -like Cobra, but it additionally required mozilla's rhino javascript library; so this is as crazy as ######. It is like Java calling for javascript functions to work. No wonder nobody does html dom manipulation with Java and go for JSP. But for JSP i need a server and it is quite troublesome.
  8. Yeah, i took a look at that one before.The reason i choose to do it with the textarea was because it only required on element while the conventional way uses three elements (two buttons and a textfield).I was hoping that somebody knew some trick or that in was someplace of the dom i couldn't find would have the customization of the scrollbars. (i even tried the div scrollbar trick on the textarea and didn't work)The div is a great idea and very creative too but it means that i must have multiple lines and text is not editable.If i didn't care about the number of elements needed, i just create a div with three textfields and two buttons that will spin the values of the focused field and remove the borders of the textfields while making the div's border visible so that it looks like one element. (well this would be in the case of a full date spinner)I am still considering my options and trying to come up with something good. But still, thanks everyone. I got to learn a lot and hints too.Edit: I think i found a very good example of a spinner with scrollbars.http://www.wiseblocks.com/input-components...finedmasks.html
  9. I see, that is why you people where talking about multiple liners. I love this idea and will try something with it. But one last comment is that the scrollbar is not rendered correctly in firefox. It looks like it disapears when i shrink the height to the size of a textfield. The same problem happens to the textarea though.
  10. Here is some part of the code. Now if you try it, you will immediately see that you can't get multiple lines even if you press the enter key.Parsing the text content is a lot more trouble but can be done. So like i said it is not the challenge. <html> <head> <script type="text/javascript"> window.onload = constructor; function constructor() { textarea = document.getElementById("smart"); if (!textarea.status) textarea.onkeydown = enterhit; } function enterhit(evt) { if (evt.which == 13) return false; } </script> <style type="text/css"> #smart { overflow-y: scroll; overflow-x: hidden; } </style> </head> <body> <textarea id="smart"></textarea> </body></html> The REAL challenge ares:-Enable ONLY the horizontal scrollbar to be clickclabe all the time-Give a specific handling event for the up arrow and down arrowAfter that, everything is a piece of cake compared to those.So, i believe i was not specific enough; therefore i apologize for that.Edit: even if it has multiple lines, the sent text can be parsed on the server so that it will take only the text between break lines and inside the text-cursor position will be evaluated. But forget about that. My spinner is not about multiple lines. It is about changing the complete value of it.
  11. I think that what i have been trying to do have been confused with the second post.First of all, i am only going to have a one line value.Right, no multiple lines since line brake will be disabled using javascript keystroke events handlers.Second, i want to use the scrollbar arrows as the spinner buttons. So when i click to the up arrow it will change the value.(which i don't find anywhere any javascript code or in the DOM specifications on assigning a javascript function to the scrollbar arrows,so i am asking if it is possible or if anyones knows how to)Edit: Well troubles there are going to be a bunch so not applicable is an good answer. So to make it simple, does anyone know how to assign the scrollbar buttons a specific javascript function?
  12. Yes, Deirdre's Dad. It works like a charm now. Thanks.
  13. There are a lot of things that can be done for that. One is to disable the edit and only allow the users only spin the values. Another one is to have a keystroke detector that will filter out the characters that must not go in there like line brake. And also a parser that reads the text and then decide if the text is in a valid format. If so then takes it and compute it. Otherwise the value will be reset to the previous value. Those things are easier to do for me. My challenge is in the scrollbar.
  14. I know that the usual way to do it is using graphics. But there is no point for me to create this topic if i don't find it challenging. Besides, wouldn't be great you get multiple features with only one object instead of three?Maybe i just give it up since it seems almost imposible to do it with the textarea. But if anyone knows how to control the textarea's scrollbar for something like this, please tell me. I would really like to do the spinner with this.
  15. Hm... after reading your post i tried again and i still get the same results i said. What version of Firefox do you use? I use 2.0.0.13.IE7 doesn't render it at all. Firefox only takes it when i include the tag.
  16. I tried that before. For some reason the 'hover' pseudo-class only applies to anchors. I wonder if there is any other way to do it besides using pseudo-classes and javascript.Edit: i looks like that the problem was that it is not fully supported by browsers. Firefox accepts the hover pseudo-class if i add what kind of element before it:td.mouseOver:hover { background-color: #999999; cursor: pointer; display: block;}But IE doesn't seem to accept hover pseudo-class at all.Thanks.
  17. What i want is to use css to simulate the properties of a styled anchor to any other element. (without using javascript)So let's say i have a anchor inside a table cell and when i hover it:-like a block the background color changes-the mouse becomes a hand pointer <html> <head> <style type=text/css> .mouseOver { background-color: #999999; cursor: pointer; display: block; } a { display: block; } a:hover { background-color: #999999; } table { border: solid thin; } td { width: 50pt; } </style> </head> <body> <table> <tbody> <tr> <td><a href="#">three</a></td> <td class="mouseOver">two</td> </tr> </tbody> </table> </body></html> So here i have a table with 2 cells.-The first one is the anchor i am trying to simulate-The second is a cell with class "mouseOver"So what do i do so all elements of class "mouseOver" will take simulation only when the mouse is over the styled element.I know i could use javascript ad add a onmouseover to change the style but i don't want that. I want to do it with pure css. Any ideas?
  18. @jeshI did consider the dropdown list but i still rather have a spinner. Thanks though.@justsomeguyI know it sounds crazy, that is why i am asking for ideas of if it can be done. The point is that i will of course filter keystrokes like enter keys so that it would be consumed and not shown on the textarea. But the biggest challenge for me is to find a way to control directly what the up and down arrow does when clicked or pressed. Of course, i will also have a parser for the text inside it so that it will read what the values should accept or not. Thanks too.
  19. I know it sounds crazy but i wonder if it can be done.-Let's say i have a textarea then i give it a height of a textfield.-I will only maintain the vertical scrollbar. Then maybe, could i use the textarea as a substitute of a spinner?Therefore i would have to assign a specific function for the up arrow and another specific function for the down arrow.Any ideas, comments or believe that it could be done?
  20. Hello there. New user banzemanga and nice to meet you all. I would like to learn from you people, thanks.
×
×
  • Create New...