The url section works fine. If i check the source code, the attribute data-zoomsrc is never displayed. However, if i write it out in the javascript, i get the value i am after:
I'm having trouble finding the image element by attribute "MyAttr" whose value is supplied: when the "onclick" function is called: <div class="MyImages"> <div class="imageClass"> <img ... myAttr="abc"/> </div><div> <img ... onclick="findTheImageObjectByMyAttr("abc");" /> </div><div class="imageClass"> <img ... myAttr="def" /> </div><div> <img ... onclick="findTheImageObjectByMyAttr("def");" /> </div></div>
The technique for getting the name of a span element should be just like getting the name of any other element, I would think... but it doesn't work in FF or Chrome. Here's some example code:
<script type='text/javascript'> function test(el){ var boink = document.getElementById('boink');
Is there a way I can make this code work: <script type="text/javascript"> function changeText(){ document.getElementById('boldStuff').innerHTML = 'Fred Flinstone'; } </script> <p>Welcome to the site <b id='boldStuff'>dude</b> </p> <input type='button' onclick='changeText()' value='Change Text'/> with this: document.write('<param name=avatarID value=4>'); So when I click the form button it changes the value 4 to Fred Flinstone
I am just working on a project where i have to replace the href-attributes of all links by another string. The problem is, that i need the old href-attribute to generate the new one, and i have no idea how to get it
i tried it with something like this, but it doesnt work [code]...
I know there is some way to do it but i forgot it and i looked up the whole internet for it and didnt find it
What I’m trying to accomplish is set an attribute called opacityin any element with a specified value that can be used to toggle whenever the user hovers over the element. The code below works perfectly but one other thing I would like to be able to do is retrieve the attribute opacity after the document loads and fade the element to that value instead of hard coding the ".66". This is probably fairly easy I've just never ran into a situation where I needed to do this.[code]...
I quite like the fact that you may add through JQuery an attribute like alt or title to an element. And I can see that you may also add mouseover using: $('#aa').mouseover(function(){//does something in here}); However, I want to be able to pass some very specific values too and that's where I'm stuck for an answer. Suppose I want to attach the following: mouseover="hm(this,'la1',5)"attribute to an <a> tag. How do I do this by using exactly those values inside the "hm(this,'la1',5)" ?
I have a standard menu structured with an unordered list. Some of the items in the menu have sub items, but are not themselves links. Here's an example:
How do I select a tag that does (or does not) have a particular attribute? In my case, I want to be able to select all <a> tags in #mainMenu that do not have the href attribute.
but none seem to be working. The img gets generated by another script so I can't add an id or class to it. I figured an expert at selectors would be able to explain how to select it.
I have a table with several columns containing input elements populated from a database, e.g.,
On every row, I need to perform a calculation using the value of several input fields. So I tried to access the value of the first input field like so (which had worked in another function):
But for some reason it's returning a 0, and the line below also doesn't work:
But this returns the correct class, so I know it's finding the element:
And if I assign the input element an id, say "count," this works:
Obviously I don't want to fuss with individual id's to get the values. How to understand why the first two examples don't work, and how to fix them?
I just have a question regarding the wrap attribute of the <textarea> element. I am using Programmer's Notepad. I am doing an example using the split() method in JavaScript. On the <textarea> element, it has specified that I use the 'wrap' attribute, yet when I enter this code, my attribute highlights red (which usually means that you have made a spelling mistake with the element/attribute). Now, obviously I know I haven't spelt wrap wrong and it certainly tells me in this book that you can use this attribute, so is this attribute deprecated?
Anyone know if there's a simple way of revealing all elements on a page that have a title attribute? I want to stick a script in a favelet to use as a development tool (highlight all titled elements with red border, etc)
I don't want it to be limited just to links or form elements.
If there's not something already out there, I'll probably have a hack at some existing favelets I have on my site, but no harm in asking if one's out there already, eh?
I'm attempting to submit a form via a function which dynamically creates a hidden input:
function submitLocation(theForm) { var e = document.createElement('input'); e.setAttribute('type', 'hidden'); e.setAttribute('name', 'location'); e.setAttribute('value', Ƈ'); var f = document.getElementById(theForm); f.appendChild(e); document.forms[theForm].submit(); }
The function is called from an anchor's onclick event:
I'm attempting to write a quick piece of Javascript code that will validate if the end user of the javascript has the necessary VML attributes set in their HTML. The problem in IE is that "xmlns:v" does not appear in their attributes property or the getAttribute('xmlns:v') calls. The real kicker is that the 'xmlns' attribute does return something.
I have a set of elements with the same function attached, how do I get the ID or other attribute value of the element that caused the function to be called?
but having fun with it. Would like tolearn how to do the following...2) Find the parent <li>.3) Grab the value of the attribute "jcarouselindex" and put it in avariable to be used elsewhere.Sample code below...
Do we have any alternative for orientation attribute of Td element in javascript for firefox? Below code works fine in IE but throws undefined in firefox:
I have a page which contains an <ul> list with 5 items. Each of those items has a data-weight attribute which corresponds to its importance in the list. I have to make only one random list item appear and use the weight to make sure that the most important one shows up more often than the least important item.
I am trying to gain access to the src attribute of an image yet I keep getting undefined when I try to alert it. However, if I alert using the html() function I get the entire string for the img element. See code below:
I am trying to refresh an image on the page but it is not happening. I have a page with images and I need to update those images as required. To update an image I upload the image on a lightbox and then close the lightbox. The image on the page should update itself. Now, I tried $('#imageid').attr('src', newimage). I want to make a special mention here that the name of both the old and new images are same. And I feel this is the problem. If I hard code any other image it does appear as soon as the lightbox closes. But, when I try to refresh the image by putting the same image name for the 'src' attribute then nothing happens.
I am working on an Image Map project, the project must be written under xhtml 1.1 and must validate. The problem is Firefox and Safari will not support the image map without the name attribute, internet explorer does. If I add a name attribute to the image map, the code will not validate under xhtml 1.1. Is there any way to have this work without the name attribute in FF and Safari? The inline styles will be remove later and I would also like to replace the variables with an array but for now the focus is on getting this to work in FF without the name attribute. I can just change the doctype to transitional but we have to use xhtml1.1.
Here is the code: Code: <script type="text/javascript"> var koalaMouth = "This is my left ear!"; var koalaLeftEye = "This is my left eye!"; var koalaNose = "That is my nose!"; var koalaMouth = "That is my mouth!"; var koalaRightEye = "And that is my right eye!"; function writetext(message){ document.getElementById('displayText').innerHTML=''+message+''; }function defaultText(){ .....