cross-browser

document.setAttribute

◇◆丶佛笑我妖孽 提交于 2019-12-10 15:37:21
问题 Can this be used to change CSS? Cant see much on w3 about it. Anyone know anything about it. If this forum/site isnt the place for asking browser standard questions, can someone point me in the right direction? Thanks --Mark 回答1: Yes, you can use setAttribute to change the CSS of a single DOM element, like so: document.getElementById("something").setAttribute("style", "color: red;"); However, I believe it's bad practice. You can modify the stylesheet as Marius pointed out by doing: document

Blank links opens in the same window - Why, and how to fix it? [closed]

谁说我不能喝 提交于 2019-12-10 15:12:03
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 8 years ago . I have four links: <a href="http://google.com" target="_blank">Google</a> <a href="http://bing.com" target="_blank">Bing</a> <a href="http://yahoo.com"

Repeated IDs in an html document .. how bad an idea is it if they are scoped by a div with a unique ID?

↘锁芯ラ 提交于 2019-12-10 14:58:55
问题 I have an webpage which shows a single item for sale with an add to basket button. The page makes use of alot of javascript to allow the user to customise the item.I now need to modify the page to show multiples of similar items on the same page, each additional item also customisable in the same way by the user. The javascript makes heavy use of id's in the markup to find elements and manipulate them to provide the client side item customisation. My 1st thought is to allow the html markup to

Why colgroup/col doesn't work in Chrome

别说谁变了你拦得住时间么 提交于 2019-12-10 14:54:27
问题 One of the answers to my previous question states that colgroup/col should work in IE only. I've wrote an example (see below) that works on IE9 (centers cells content in the the 3rd column), but doesn't work on the latest version of Chrome. What I did wrong? Example of HTML: <html> <head><title>test table centerring</title></head> <body> <table border="1"> <colgroup> <col/> <col/> <col align="center"> </colgroup> <thead> <tr> <th>#</th> <th>Name</th> <th>Value</th> </tr> </thead> <tbody> <tr>

css in chrome only works after inspect element

坚强是说给别人听的谎言 提交于 2019-12-10 14:27:35
问题 I am using flexslider JQuery plugin to slideshow several elements in my site. I also use JQuery .click() event and fadeIn() fadeOut() effects on the elements that apply flexslider. my site looks fine in firefox, but when i open it in chrome, the slides are stacked in one page. but what confuses me is, when i use inspect element in chrome, it sets the layout right, just like in firefox. can anyone explain what's happening? EDITED: okay after some inspection, the layout changes when the width

Iframe Cross domain communication - resize event - cross browser?

会有一股神秘感。 提交于 2019-12-10 14:04:27
问题 When the main Window wants to send message to a child Iframe - It sets the child's Iframe url to its current url+ hash (which represents data). But how would the iframe get's the new data ? We have 4 options : ( i'm not talking about new api's eg postMessaage nor XDM libraries) The child is polling the new hash ( setTimeout) The main window can resize the iframe (the iframe must register onResize ) The OnHashChange Event can be used on the iframe Destroying/creating proxy Iframe which uses

What is the correct way to deal with css browser compatibility?

ぐ巨炮叔叔 提交于 2019-12-10 13:55:01
问题 Is it better to have a different CSS file for each user-agent or is it better to use CSS Hacks that only certain browsers can see? 回答1: Neither. The best is to write code that works in all browsers without the need of browser specific code or css hacks. It's of course not quite as easy to accomplish, which is why many people use the other methods. The key is to avoid things that some browsers (very often Internet Explorer) has problems with. One such thing is to use padding rather than margin

Programmatically Bookmark Link with Javascript Cross-Browser

China☆狼群 提交于 2019-12-10 13:30:07
问题 Is there a script out there that solves this problem? I would like to be able to say "onclick, save as bookmark". I have searched around a bit and found this one, but it doesn't work with Safari. Anyone have a solution for Safari? 回答1: I'm afraid that you simply can't do this in every browser. Besides, if a user want's to bookmark your page he has the tools built into his browser ... 来源: https://stackoverflow.com/questions/1896427/programmatically-bookmark-link-with-javascript-cross-browser

What is supposed to happen when an img can't be displayed?

和自甴很熟 提交于 2019-12-10 13:22:21
问题 What is the browser supposed to do exactly when an img can't be displayed? The official sources are deliberately vague about this. They say the alt text is supposed to be used, but they don't say how ! So unless I haven't searched good enough (and I did a lot of Googling. I even Binged!) this information isn't there. And the browsers differ widely in what they do. If an image can't be loaded because it isn't there, Mozilla displays the alt text inline as part of the current text IE displays

How to use <col> tag correctly and is it supported in all browser?

蓝咒 提交于 2019-12-10 13:07:29
问题 What is the use of <col> tag and is it supported in all browser? I was trying <col style="background:red"> but it's not working. I'm on Firefox 3. <table width="100%" border="1"> <col style="background:red"> <caption> Table Caption </caption> 回答1: It works, but it doesn't affect the caption. Working example: <html> <head> <title></title> </head> <body> <table> <caption>test</caption> <col style="background:red" /> <col style="background:blue" /> <tr> <td>red</td> <td>blue</td> </tr> <tr> <td