I have a custom HTML tag: <custom>text is here</custom>
I can do anything I would like in terms of calling methods with mozilla
but not IE 6. For instance calling appendChild in IE results in an
error. The innerHTML property is blank even though there is text
between the tag.
Is there a work around for IE. What gives with IE and being able to
access and manipulate custom tags??
I know very little js, but I've been reading up on it, mainly for one reason. (I'm a PHP programmer and I've just used js for small tasks like client-side form validation, that sort of thing).
What I want to do is make a textarea with buttons, similar to a BB editor, but which will use defined html tags; I'll use <div style="box1"> and <h1 style="greenunderline"> for examples. I've tried to modify some open source editors and get utterly lost in trying, and I'm not sure that approach would work anyway.
The buttons would need to function two ways, again like a BB editor.
1) It could simply insert the start and end tags in the textarea;
2) If text were selected, it would put the tag in front of the selection and the end tag after.
If I can get this done, I think I can handle a preview function. I haven't even gotten close to getting javascript to "get" selected text inside a textarea.
I sometime find it useful to add my own attribute to a HTML tag so that my javascript can access those elements. For instance, new_attribute in the following anchor tag:
When trying to validate this page, however, it doesn't pass. Some of the below questions likely do not make sense, but I hope you get the idea what I am looking for:Is what I am doing bad practice?Is there another way to allow javascript to specifically select just some elements and not others? Should I instead apply multiple classes to the element, and use some of the classes not to modify appearance, but to allow just them to be selected?If using custom attributes, should they somehow be defined so they pass validation?
I have a dynamic HTML table which gets populated by coldfusion and displayed, I have a column called performace which holds numeric values. I need to select the top 3 best performace value in the column and then highlight the entire rows in different colours. Can any one help me in doing it?
My server can run only Javascript and coldfusion, No Ajax/PHP.
Hint : Something like a code to highlight a <tr id=#idx#> with this ID = #idx#.
simple code page with div content, there some things and i do :alert( $("#content").html() ); gives me really nasty code in IE it adds some of default values, changes code to uppercase as for really old html opera and firefox works fine is there a way to avoid custom code added by IE?
I am trying to find how to use custom tags in html and render data based on their use.
A good example is the joomla <jm:whatever> tag.
I found the following article: [url]
I think it might be outdated though because the behavior:url element does not seem to work. Plus, when I check the style sheet on a joomla site, it doesnt seem to use this method. I think these tags might be xml but I do not know how to render them based on the tag.
For example: <customAbbrv:display src="test.html" label="Test" />
I would want this tag to fire test.html and pass the attribute label which is set to Test.
I am searching for a jQuery plugin for screenshots gallery, similar to Lightbox, FancyBox, etc. The problem is - I need to display HTML description for each screenshot.
I found a great one that allows layover for any DIV on the page: [URL]
but this one doesn't have a prev-next functionality for multiple divs, as I need to present these in a gallery view.
Do you know any plugin that allows that, or do you have idea how to extend the script to work the way I want?
Here's what I'm trying to do: 1) I get reference to a div that's on my page: var theDiv = $("#" + divID); 2) Now I want to add a custom attribute tag to it, so for instance I want to add "winWidth" so that the div object now contains "winWidth=" for instance. 3) I want to set winWidth now since it's part of theDiv to a value
I'm not sure how to really do 1 + 2. I need to do this on the fly because some javascript logic later will add these attributes dynamically to the div... outside of what the original div had...I don't care what it had, I know I have it now in a JS variable and now I want to both add some new attributes to the div, and then set them on the fly. I don't need these attributes to be on my page, I just need them added to my div variable reference.
I cannot get an appendChild(img) in the following code snippet to work in IE. However, the same script works without any problems in Firefox and Netscape 7.0 The error that is produced in IE is invalid argument. I have used a try/catch block in expectation of producing a better error message however the error message that is received is [objectError].
var pageDiv = window.parent.fraTop.document.getElementById('pageTitle'); if(pageDiv!=null) { while(pageDiv.hasChildNodes()) { pageDiv.removeChild(pageDiv.firstChild); }
var img = document.createElement('img'); img.src='/wp2f/images/please_wait.gif' pageDiv.appendChild(img); }
Can anyone tell me: 1) why my string appears twice; 2) how to make it appear just once?
I'm trying to insert code at the top of every viewed page. Obviously, document.body appends the string to the closing body tag which is not what I want. What could I use to insert my code as the first childnode under 'body'?
I'm trying to spread a table across a frameset. So I have index.htm that has an iframe sourcing the frameset. What I'm trying to do is create a table in index.htm to spread across the whole brower window. Code:
var newText = parent.frames[1].document.createTextNode("some text"); var theBody= parent.frames[1].document.getElementById("theBody"); theBody.appendChild(newText);
This will insert an element after the last <p>, can I insert one after the body but before the first <p>?
Over the last couple years I've built up a DOM library. Nothing fancy, you can just create an element with all its attributes in one function. What I've wanted to do is make it so you can determine the parent element of the newly created element. Works supa in firefox, not so supa in IE.This is my code....
Code: pollOptions = document.getElementById("pollOptionsContainer");/*new divs to organize it in*/ pollOptionsGroupContainer = buildHtml.createDivHTMLElement(pollOptions);
Why doesn't the following code work in firefox: var e = document.createElement("Div"); e.innerHTML = "<p>Hi</p>"; GP.appendChild(e); ..GP is a div.. It works in IE. What is the correct code for FF.
i'm trying to generate a calendar using dom to create a table. it works in firefox and opera, but ie won't show it, and sometimes gives me an alert saying it can't display the page, and then shows a 404 page. here's the code:
I have a simple two frame page (top and bottom; parent called index). and I am trying to dynamically create forms in the bottom frame when buttons are clicked on the top page. But I keep getting an error in the line labelled * below inside addBlock1(). Here is my code (which is in top.html): Code:
FYI the $ is just a prototype function for getElementByID the error i keep getting says that "targetDIV has no properties" not sure what that means exacly. Any ideas?
I am trying to create one image using JavaScript; then later in the script remove the image - not just remove the src. The following creates the image, but I have been unable to remove it.
How do I structure document.getElementById('num1').removeChild(image_ display); ?
If I try to append a PARAM tag twice I'm having problems:
var.medDiv = document.getElementById("myDiv");
var medObj = document.createElement("object");
var p = document.createElement("param"); p.setAttribute("FileName",this.URL); medObj.appendChild(p);
p = document.createElement("param"); p.setAttribute("AutoStart","false"); medObj.appendChild(p); // <-- this one
medDiv.appendChild(medObj);
The line with the "this one" comment triggers IE to tell me that it has an invalid argument. If I change the order of the PARAMs then the new second PARAM will give me the error. If I move the setAttribute to after the appendChild I still get the error.
This example will show that the first call to "doit()" will print 30 times the image with only one call to the server. Then I have a timeout and call doit() again, and this time, it downloads the picture 30 times!!!! It doesn't even time to finish downloading the pictures before the next timeout kicks off and if I let it go for a minute or two i have like 300 calls to download the same image trying to be downloaded!
I heard about a bug in IE that would require to preload the images using a hidden div, but that didn't work. I see that google maps manage to not having to reload the image and gets it from cache. What am I doing wrong? This works perfectly in Firefox (i.e. it uses the cache and calls the server just once). Code:
I have 2 list boxes - one to fill the second one based on the selection, or move all items. You can remove the selection (or all items) from the second one to place it back in the first one. I expanded my horizons and thought to use script based on the js node operation appendChild(). It seemed so clean and easy to follow. Works beautifully in IE, but Firefox sees the value for a nanosecond but doesn't put it in the box. This is the relevant js:
function addSide(){ var addIndex = document.forms[0].sides.selectedIndex;
if (addIndex >= 0) { document.forms[0].selectedSides.appendChild(document.forms[0].sides.options(addIndex)); }}
function delSide(){ var selIndex = document.forms[0].selectedSides.selectedIndex; if (selIndex >= 0) { document.forms[0].sides.appendChild(document.forms[0].selectedSides.options(selIndex)) }}
function addAll(){ var len = document.forms[0].sides.length -1; for(i=len; i>=0; i--){ document.forms[0].selectedSides.appendChild(document.forms[0].sides(i)); }}
function delAll(){ var len = document.forms[0].selectedSides.length -1; for(i=len; i>=0; i--){ document.forms[0].sides.appendChild(document.forms[0].selectedSides(i)); }}
Is there a way to make it work for FF, or do I need to just start over and not use appendChild()? Is there a better way?
I'm playing around with some AJAX-ish stuff and encountered some problem in the JS side of the universe. Maybe someone here can suggest an alternative that works.
I have developed a simple ASP.NET application with a web page that should display a list of users. This list page is designed to start with an empty table (with columns defined), and, onload, send an XmlHttp request to a server component (a.k.a. ListServer). This ListServer is currently simulating a long-running operation. So, it sleeps for 3 seconds, and then grabs a list of 4 users from an xml file. It applies an xsl transformation and returns the result.
The xslt is designed to take the xml data and convert it to a <ListChunkroot element containing a <trfor each user in the XML data. Each row contains 4 columns (Id, Login, Password, Name). The javascript in the list page grabs the responseXML from the XmlHttp object and should, for each <trin it, create a copy of the row coming from the server and adding it to the list on the client.
I actually got all that to work quite fine. The js snipplet dealing with copying the row coming from the server and adding it to the table on the client is: Code: