I'm trying to change the CSS of a div that looks like a line so that the line appears to move down the screen. I'm getting no response as yet, just the div and button on screen. This script is in the head:
Code:
<script type="text/javascript">
function moves() {
if (tops < 500) {
I want a function on my form and when I'm calling that function (i.e. pressing a button), I want to resize the window (only height) with the paramater that I'm supplying to that function. Is it possible?
I'm having 3 images work as 3 buttons. I want to make them when the user clicks on one of them it changes it's image and the image of the other 2 div tags.
Here's my html code <!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.0 TransitionalEN" "[URL]"> <html xmlns="[URL]"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="css/style.css" /> <link rel="stylesheet" type="text/javascript" href="js/Javascript.js" /> <script language="javascript" type="text/javascript"> function changeDiv_ToEnglish() .....
And here's my css code for only the 3 divs @charset "utf-8"; /* CSS Document */ #empty { width:69px; height:40px; float:left; } ..... The problem is : nothing occurs when I click on the arabic , english , japanese divs.
I have created a javascript object (ajaxQue below) that contains a method (this.get() below) that is a wrapper for the $.get() function and another method (this.jobCompleted() below) that is the callback argument for $.get().
The callback method refers to the javascript keyword 'this'. But 'this' doesnt seem to refer to my instantiated object as I would have expected, instead it seems to refer to something inside AJAX. So I can no longer refer to properties within my object (e.g. 'this.prop1' below). I have included a simplified version of my code below. Is jQuery messing with my callback function ?
I have the following form working with on onsumbit function, but I would like to change it so that instead of having to click the purchase button to see total price, you only have to change the quantity text box input. I just can not seem to get it to work.
<script language="javascript" type="text/javascript"> function checkQuantity(frm) { var succesful = false; var numQuantity; numQuantity = parseInt(frm.Quantity.value); var numTotalPrice;
if (numQuantity != 0) { numTotalPrice = numQuantity * 4; frm.TotalPrice.value = numTotalPrice; //new String(numTotalPrice); successful = true; } else { alert("Sorry must order more than 0"); successful = false; } return succesful; } </script>
im trying to change a variable set outside of a function and calling the function with an onchange... i'm having problems getting the variable to change
My problem lies in that I have multiple of these forms on a single page, each one named autoSubmit. I easily rename each with PHP to autoSubmitXXX or YYY depending on their record id numbers, but then the .autoSubmit(); function doesn't know which form to work with.
Code: '#autoSubmit INPUT'
I can grab the individual form ID (XXX or YYY) with:
I have a list of most 17 recent entries from a db table and wanna use jquery/ajax to have a next button that loads the next 17 entries when you click it. It passes the 17 variable to the .load which works fine first time around (this is later used as mysql limit), but then I try to increase the start variable with 17 so that next time I click it would pass 34 to the .load (so it loads next 17 again) but this doesn't work, it simply loads same 17 again on 2nd, 3rd ect. click (so nothing changes). use global variables by setting it with var and using it without var inside the function.
<script> var start = 17; var loadUrl = '<?php echo site_url('welcome/battles'); ?>'; $("#latestbattlesnext").click(function () {
I am currently working on a tween script that I am hoping to make so it allows the user to choose and object than the property it tweens, whether it be height or opacity.so currently my problem is getting the function to accept dynamic property selction.for example, the following.
Code: function tween(object,property,to,time){ original = object+property;
I'm only new to Jquery and Ajax for that matter, understand JavaScript but don't work with it everyday. I have a function from Jcarousel that is populating a div with images (talking to a .txt file which contains the url), JavaScript then writes out the image. function getItemHTML(data){ var split = data.split(";"); var url = jQuery.trim(split[0]); var title = jQuery.trim(split[1]); var url_m = url.replace(/_s.jpg/g, '_m.jpg'); return '<a href="' + url_m + '" title="' + title + '" class="thickbox"><img src="' + url + '" width="' + 75 + ' " height="' + 75 + '" alt="' + title + '" /></a>'; };
And this is the function talking to the datasource function loadItemHandler(carousel, start, last, available){ if (available) { // Trigger loaded carousel.loaded(); return; }var cr = carousel; jQuery.get("example_dynamic_ajax.txt", function(data) { appendItemCallback(cr, start, last, data); });}; Now what I would like to do is instead of populating with images from .txt file I would like to populate with code from another .html page (a html page containing a table code). I'm just not entirely sure what object I need to use and how to go about that. Full code that I am working with is here: [URL].
I have this code and when you click on the first set of them (a specific one) it copies it and then when you click on one of the other ones it pastes it but its not working properly. (If you need to you can put an other image in there)
I currently have a normal link like Code:<a href="http://sitepoint.com" class="link">sitepoint</a> and when a user clicks on it I want to be able to change the "link" class to a different class. However, I don't want to add anything to the actual link html. Is it possible to do this using javascript without modifying the original link code?
I am trying to dynamically clear the value of a form input field and then submit the form.When I used $('#my_field').val('') to clear the field, it was cleared on the screen but when the form was submitted the original value of the input field was posted.My browser is FireFox and I can see using FireBug that when the field is cleared, firebug is still showing the html code with the old value. E.G. <input type="text" value="old_value" />The same situation occurred if I used $('#my_field').attr('value', '') to clear the field.The same situation occurred if I actually changed the value of the field rather than just clearing it.To work around this problem I ended up using the $('#my_field').removeAttr('value') to clear the field before it was submitted.
I have a set of radio buttons on a webpage. Currently they all have the same name so that when one gets clicked on, the other one is no longer checked.
Now I want to dynamically change which one is checked from within a JavaScript function.
2 Questions,
1) I assume that I will need to change them so they all have seperate names right? Otherwise how else will I be able to refer to them?
2) What would be the syntax for doing this within a Javascript function? I.e. RadiobuttonName.checked="checked"?? Something like that?
I am a complete novice when it come to Javascript. I copied the script for displaying random images at a specific interval (from javascriptkit.com). I would appreciate knowing whether the following is possible:
The pages are based on tables, so the parts that change are all cells.
1. Can I define text instead of an image in the array? i.e. can I have the image change to say an apple in one cell and the next cell have text explaining what an apple is?
2. Would it be possible to put a countdown timer for when the image/text is going to change?
Ive got a small image of a power button and when pressed the inner section on the button changes to yellow, but when its pressed down Im also trying to get part of my H1 (main header logo title) to change to yellow.
Ive created a span with an id surrounding the letters of the H1 that I want to change, the id being : "power";
The javascript that I have come up with so far and works is as follows:
<img id="poweron" src="http://www.sitepoint.com/forums/images/power.png" alt="Power on button" onmousedown="this.src='images/poweron.png';" onmouseup="this.src='images/power.png';"/>
I understand Im not really supposed to be using inline JS, and I know Ive got to create a function for the onmousedown event to trigger changing the H1 text, so am I under the right impression that the JS so far written is redundant and will have to be re-written so thats contained within a script placed just before the closing </body> and an external script for invoking the main function ?
Has anyone ever had problems with changing the src of an embed after the page has loaded?.
I have had this problem 2 times now and in result have had to actually reinitialise the embed on the page with its new src. Is there not a way round this which will save alot less time and alot less coding.
I am working on a Windows application (in C#) that displays some HTML. In one place the HTML is a status window. What happens is the static HTML page is embedded into the application. The static page displayed and then the C# code gets a hold of the HTML DOM from the web browser and updates what pieces need to be updated.
What I need to do now is change the colors of everything on the static page. At present there is an embedded CSS style in the HTML and all the colors are defined there. Using the DOM, via C# code, how do I change the colors of everything?
1: Can I simply update the CSS and it will auto magically happen? If so, how does one update the CSS via the DOM?
2: Do I need to go to each individual item and change the color there?
3: Is there a better way to do this all the way around?
I have a few radio boxes where a user can choose different options and I want to show an explanation of each option after it's clicked. Here's what I have:
'function describetype(){ ' if (window.event.srcElement.value == "starter") typedesc.innerHTML="A Starter request is for a new employee who's never worked for cadbury or the Bottling Group before."; ' if (window.event.srcElement.value == "leaver") typedesc.innerHTML="A Leaver request is for an existing employee who's permanently leaving the company."; '}
'function starter(){ 'typedesc.innerHTML="A Starter request is for a new employee who's never worked for cadbury or the Bottling Group before."; '}
'function leaver(){ 'typedesc.innerHTML="A Leaver request is for an existing employee who's permanently leaving the company."; '}
function describetype(o){ if (o == "starter"){ typedesc.innerHTML="Starters are...etc."; } if (o == "leaver"){ typedesc.innerHTML="Leavers are...etc."; } }
</script>
The first "toggle" function works fine but the "describetype" won't work. Here's the HTML:
The error keeps saying that "starter" or "leaver" is undefined. I'm not much of a javascript guy (mostly the cut and paste variety myself) but everything I've seen says this should work. No?
for IE 5+ I need to be able to change certain TD tags� background colors, and can�t figure out how to do it...
For instance, in a table with 25 cells, somewhere between 5 or 10 will need the bgcolor to change at the same time when a user clicks a button. Right now only one changes when I use something like this...
document.getElementById(�cellchange�).style.backgr oundColor = "FFFFFF" ** (Note, this is not the EXACT code, I am typing from memory... but it is SOMEthing like thw above...)
where a few td cells have an "id=cellchange" in there tag. I need ALL of the ones with that ID to change!
Is there a getElementByClass, for multiple similar elements?
having a small bit of trouble with some javascript trying to change the background color of a div. The div is id=break and the function to change it is:
function changeBG(){ document.break.background-color = 'ffffff#'}
However that does not work, no colour changes. There is no obvious errors that I can see. Have I misundertsood?