i have the following code which creates tr and td elements then adds them to a table. combArray is a global array and there are no problems inserting all the values. the only problem is assigning a colspan = 7 has no effect; everything is still squished into 1 row. The entire function runs and is not crashing. i even try and assign colspan twice, once on line 11 and again after the row has been appended at the end of the function on line 40. why isnt colspan working?
I have the following code which creates tr and td elements then adds them to a table. combArray is a global array and there are no problems inserting all the values. The only problem is assigning a colspan = 7 has no effect; everything is still squished into 1 row. The entire function runs and is not crashing. I even try and assign colspan twice, once on line 11 and again after the row has been appended at the end of the function on line 40. Why isn't colspan working?
Code: <script type="text/javascript"> function fillVariables( idDigit ) { var tbody = document.getElementById("zrow" + idDigit + "tbody"); var newNodeText = ""; var varCount = 1; var fixedCount = 1; .....
In IE (tested 7 and 8), $('td[colspan]') seems to match every single td. In Firefox and Safari, though, it (correctly) returns only those which do have a colspan attribute. Here is a simple test:
Basically in IE, if a CSS width is defined for a cell (<td> element) as well as having a colspan attribute allowing the cell to span more than one collumn, the cell (eg the border etc.) will occupy the width*colspan but the content will only occupy the width.
I tried to dynamic add a row to table(tbody) it works in IE and Firefox with the following codes. But when I try to set the "colspan" attribute to the TD, it only take efffect in Firefox but not in IE.
Code: var contentsTable = $("searchResults"); var tr = document.createElement("tr"); var td = document.createElement("td"); td.setAttribute("colspan", "3");
I am seeking to change the color attribute in my CSS file under the ID's #realmaturesingles and #seniorpeoplemeet upon the hovering of these links. These two ID's are initialized inside an <a> tag (these are links). How can I do this with JavaScript? This is what I tried:
Im having a bit of trouble with the bounce show effect from jquery ui. To see what I mean, check out my development site. Anytime you modify a part in this computer builder, the rigth side gets updated. Right now its removing and adding list items. Problem is when click items too fast, the animation doesnt finish and the next item gets bumped lower and lower.
Any neat way to copy a snapshot of one array to another?
A normal assignment results in the second array pointing to the first, with changes to either array affecting both.
As a trivial example:
var a=new Array(); a[0]="zero"; var b=a; b[1]="one"; alert("a="+a.join("*")+String.fromCharCode(10)+"b="+b.join("*"));
.... this results in a and b being identical two-element arrays.
Is there any easy way to set array (b) to be a copy of (a) BY VALUE - ie using the contents of (a) as they were at the moment of assignment, but leaving the two arrays separate so that subsequent changes to one array does not affect the other?
I have an index.htm page ready. I want to be able to put in javascript code into the HTML coding that will write the ip address of the actual server that is hosting the website into a hidden text box. Then I want to insert this ip address into a hyperlink in the original index.htm to link to another html page (this will be a SSL secure page instead i.e. [URL].Also vice versa. (With SSL index.htm page have code that writes ip into hidden text box then hyperlink to the original http index page)
I have the html contents from an iframe stored in a mysql data record. I now want to load that back into the iframe. I can assign the php var to a js var using PHP Code:
var scontent='<? echo ($html) ?>'
but the string has been saved to the db with newline chars in it and is causing a js error because it is being interpreted as an un-terminated string:
var scontent='<P>This is a test</P> <P><FONT color=#ff0000>Red</FONT></P> <P><FONT color=#ff0000><STRONG>Bold</STRONG> <U>Underline</U> <EM>Italic</EM></FONT></P> <P><FONT color=#0000ff>Blue</FONT></P>'
I have tried stripping the newline chars out using php: PHP Code:
var scontent='<? echo (str_replace(" ","",$html)) ?>'
It didn't work. I was wondering if there was a way of assigning multiple lines to a js var. any ideas?
I am creating a tool to merge xml files using xslt usin Javascript/HTML.
Basically the user browses (browse button) to where there xml file are, then browses to where their xslt file (to perform an operation is. Then they click an "apply" button and the result is output in frame below.
My problem:
I have the tool working fine when I only have one input xml file (whic is no good in a merge tool!!) but when I modify the code and ad another xml field, the apply button will not work for two fields!
I think I haven't assigned the functions correctly to the xm fields/apply button. Heres some of the code I suspect is wrong, but i not sure where?? Code:
I'm trying to create a function that will return the value of responseXML so I can assign a variable to it.
Code:
ajax.downloadXml = function (url) { var XMLHttpRequestObject = false;
[code]....
Stepping through the function, the onreadystatechange seems to never be executed, so nothing is returned. There's probably just a fundamental I'm messing up on.
3-level dropdown box: [URL]. Now in this dropdown menu if you select: Category > Cars Sub category Cars for Sale Sub Sub Category Ibiza
What I want to do is two things: 1)Place a value on all the Sub Sub Category(ies) so for example the value of Ibiza I want to = 55 2)Then Grab that value? How would I get that value and grab it from POST?
I am barely familiar with javascript. I have this html code with an embedded iframe. The html file in the iframe refreshes every once in a while. That is fine. However, in IE, there is this annoying click with every refresh. I googled a bit and saw a few solutions. Seem to me that if I fetched the contents of the HTML file (AJAX call) and assigned it to existing document.
I have a situation where I'm trying to assign a value to an elements innerHTML. When I do this, the value is assigned, but it causes havoc on subsequent javascript calls.I realize this is kind of vague but I'm at my wits end on what to do. I've tried assigning the innerHTML value "NA", just plain text, and it has the same effect.Without being too confusing, I have a table of data inside a <div> where the user can navigate up/down by pressing the <enter> key, pg up/pg dn and arrow up/arrow down. When they move from record to record, I'm highlighting the new row and "de-highlighting" the old row. The row has many fields but only one fill in field which is where the user enters the quantity of the item to be ordered. This is on a local network using the Firefox browser.
Without the above line, all is well. When I use the above line, it messes up the highlighting of the row but also makes the fill-in field "appear" disabled. What I mean by that is when you type a number, you don't see the value change (even though the field has focus and the value is selected) but once you leave that line, the value you typed then appears in the fill in. Normally the value will change as you type a new value.
I'm running a PHP script to check whether the user is logged in or not. If the user is not logged in they are redirected to the login.php page.What I would like to do is redirect them to the PHP page but also grab the URL they were previously on and assign it to a hidden field in the login.php so that I can redirect them back to the page they were on while keeping the URL bar clean.Problem, I know that PHP cannot recognize a hash [URL] so I would need to grab the url through javascript instead of PHP.
I am currently putting together a trivia game and I have stored several items in an array for example the questions, and the answers, points value... etc.
but my dilemma is I have to assign an "id" to the elements in the the array so i can use the function getElementById() to call the information. I do not have a clue how to do this.
*** also the second issue is my array is showing an error as UNDEFINED BUT i have declared it in "var triviaArray"
this is my array:
var triviaArray = new Array [ triviaArray["What's the capitol of Canada?","TORONTO","VANCOUVER","OTTAWA","QUEBEC",10,"choice3"], triviaArray["How old was Michael Jackson when he died?","35 yrs","50 yrs","40
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>test</title> </head> <body> <script type="text/javascript"> try{ var foo=document.writeln; foo( 'Hello, world!' ); } catch( e ) { alert( e ); } </script> </body></html>
IE has no problem with this, but Firefox throws an exception - "Illegal operation on WrappedNative prototype object". Is it within its rights to do so?
I have a function whose parameter is a reference the element that called it:
function someFunction(el) { ... }
The function is assigned to the onclick event of some elements in the HTML source:
<input ... onclick="someFunction(this);" ...>
and dynamically to others:
elRef.onclick = someFunction;
When someFunction() is called from the statically-assigned onclick, el is a reference to the element. But when it has been added dynamically, el will be either undefined (IE) or 'event' (Mozilla et al).
To assign the right value to el, I can test if el exists and if it does, whether its constructor is some type of HTML element or 'Event'. But IE doesn't support the constructor property for elements (or have I just not found it yet?) nor does it understand 'Event' the way Mozilla does. Code:
Basically we are trying to simulate the tab key when the down arrow key is pressed. (we know there are other way to control focus flow but we use a lot of dynamic jsp fields, that will make the flow control a nightmare, we just want basic tabbing from the arrow key)
1)We are able to capture a onkeydown event and reasign it with another key value with no problem within an html document without a form.
example:
var ieKey = event.keyCode;
if (ieKey == 40) { event.keyCode = 9; }
however as soon as we insert a form tag in the document, this stops functioning. The asignment seems to be fine as an alert clearly shows, but the instruction seems to be ignored. Code:
i have an html text box (which is part of a from) to which a value will be entered by a user. i need to assign this value that has been entered to a JS variable.
I'm not even sure if that's the issue here, but I've isolated it and all the other code is working, so what I'm thinking is that if this:
Works here [url] to hide/show a line,
Then this:
Should work here [url] to show/hide lines and arrows
The difference of course being that the first code uses poly_num, which is taken directly from the var poly_num = gpolys.length - 1; code (because it only needs to show/hide one line at a time) whereas the second uses the xml attribute "category" from here var category = lines[a].getAttribute("category"); because it's attempting to hide and show a line with arrows on it (the arrows being in the pts array), both of which share the category attribute.
It's not throwing up any major errors, but it's not working, either...