Onclick Alternate Between 2 Values?
Dec 21, 2009
I currently have some simple JS setup but I'd like to alternate between 2 values using "onclick". I have setup a flash clip with a form input buttons for playback control. Here is my form:
PHP Code:
<form action="/" class="button">
<input type="button" name="" id="play" class="play" value="" onclick="callFlashPlayPauseVideo(1)" />
</form>
[Code]....
However, once this intial stage has passed, and the button is clicked again - the image needs to revert back to the "play" button - so its a cause of having the pause button on show whilst the video plays, if its then clicked, the play button shows as the video is paused.
View 4 Replies
ADVERTISEMENT
May 16, 2006
I have this table with alternate row colors. Class gray and class
white. I have javascript that do highlight when mouseover row ... and
onclick to select row and highlight it with another color. Also created
a class called "Selected". You can only select a row at a time.
My problem is, if a row is preselected, when mouseover the selected
row, the selected color is screwed. Until you click on the selected row
once, the behaviour is correct again. Code:
View 4 Replies
View Related
Jul 23, 2005
Can a javascript array value be used in an onclick event?
I haven't been successful in getting it to work so I'm wondering if it
even can be done.
onclick="calculate('some array value');
I've tried:
onclick="calculate('<script
type="text/javascript">document.write(points[0]);</script>');
There's conflict with the quotes, but beyond that, I'm unclear if this
is even a viable option...anyone?
View 9 Replies
View Related
Mar 12, 2009
how to implement it into my php pages. The best example for me to explain with, are live at facebook and youtube. Facebooks newest user status feature the "like this" link - and youtubes "favourite" link located under the player... There are tonnes more examples, and thats why im shocked that their isnt a tutorial about it anywhere...
So basically i need the user to be able to click a specific link, which then updates the database, and then shows a success message, all without refreshing the page.
View 9 Replies
View Related
Nov 15, 2010
I have a button that needs to increase/decrease the value of a text field when clicked. This code is working in Internet Explorer and Chrome, but not Firefox.
Code:
<a onClick="scorebox1 = parseFloat(score1.value); score1.value = scorebox1 - myscore; scorebox1 -= myscore;"><img src="images/minus.png" alt="Subtract Point" border="0" /></a>
<input size="2" name="score1" style="font-size:24px; width:50px; text-align:center; color:#FF0000;" id="score1" value="0" />
[Code]....
View 4 Replies
View Related
Aug 19, 2010
When you select multiple <div> get the value of each one and save in separate hidden fields accordingly.
What needs to happen is. Click div 1 --> if hidden field1 value is "none", save there, else check hidden field 2 if that's "none" save in hidden field 2
Click div 2 --> if hidden field1 value is "none", save there, else check hidden field 2 if that's "none" save in hidden field 2 Here's what I've come up with so far (currently I'm using JQuery)
The problem with this is that no matter what div I click in which order it only updates the 1st hidden field :(
[Code]...
View 1 Replies
View Related
Jun 6, 2009
I'm working on an ordering form which calculates the total order price using Javascript. I have a checkbox which I want to use to toggle the display of various items, and also reset the value of an item depending on whether or not it is checked.
Further details
I have a checkbox for the colour "Black" which, when checked, hides a SELECT, a bit of text, and "Quantity" field. It also resets the value of the "Quantity" field to zero.
When the "Black" checkbox is unchecked, the three items (SELECT, text and Quantity) are revealed again, and the Quantity field for "Black" is reset to zero and hidden.
The reason is that users can only either EITHER a black item or select from a list of colours. Black items are a different price to all others.
How the form works
When the user enters a quantity into a text field for each item, the price of that item is added to the total at the bottom of the form. When the form is submitted (with PHP validation), it emails the order to a salesperson. The price of each item (for emailing the order) is set using hidden form fields with defined values, while the order total is calculated using the id of each quantity field (e.g. "item_31_85.00").
What I need to know
I want to achieve the following when the "Black" checkbox is clicked:
Toggle the display of three items (SELECT field, text (in a DIV) and an INPUT)
Reset the value of the INPUT field (and reset a different INPUT when the checkbox is clicked again)
My current code
The code I'm currently using in the PHP form is below (truncated for readability):
Code:
<input type="checkbox" name="black" onclick="togglecontent('colour_box','colour_price','color_quantity','quantity_reset')" /> Black
[Code].....
Currently I can hide the SELECT and accompanying text when I check the "Black" checkbox, but it won't reset the INPUT value nor hide it. I've not yet attempted to do unhide and hide the Black text and input since I can't get this part working yet.
View 14 Replies
View Related
May 2, 2011
I am trying to use it to direct users to a search page based on the values of two drop down boxes. The issue i am having is that the code below works fine on a test page, but not on my test domain (with wordpress theme) and so i was wondering whether there is anything I am doing wrong... Is onclick already defined maybe? I'm not sure how it works to be honest... :(
<script type="text/javascript">
function gosearch() {
var breed = document.getElementById('breed').value;
var area = document.getElementById('area').value;
var site = "http://hairloss-help.net/?s=";
var searchurl = site + breed + area;
[Code]...
View 7 Replies
View Related
Dec 9, 2005
I am generating a html based table with multiple rows of data coming
in real time from a postgres DB. The underlying technology is java
based however the front end is html.
now i am unable to alternate the colour of every row so that the table
is lot more readable. can anyone suggest a javascript or even a css
script which will alternate the row colours irrespective of the number
of rows.
View 4 Replies
View Related
Jun 6, 2006
the bug of onbeforeunload is so obvious!
in IE 6 it will popup twice "sometimes"
I am using the following code
window.onbeforeunload = null;
window.onbeforeunload = confirmExit;
var executingPostBack = false;
function confirmExit()
{
if ( typeof executingPostBack != 'undefined' && !executingPostBack)
{
return 'Warning: Modified data has not been saved.' ;
}
}
In some cases, IE pops up it twice, for example, when we click a link
that contains "__doPostBack", onbeforeunload is fired the first time;
when the form is submitted, it is fired second time.
There is no way to work it around, because onbeforeunload is stupid, we
can't know whether the user clicks OK or Cancel.
I would like to use the following code with confirm so that I know
exactly what the user behaves
res = confirm("leaving?");
if (res==1)
{
alert("yes");
}
else
{
alert("no");
}
but I can't use this in onbeforeunload, because I can't stop it!
onbeforeunload always asks for something return, but if I return
anything, it will popup!
View 4 Replies
View Related
Dec 12, 2006
I am making a ajax form request and I am clueless on how to make an alternate submit when javascript is disabled. This is so it works without javascript and uses a separate php file.
View 2 Replies
View Related
Mar 26, 2010
For a lot of years now I've used a javascript that does a simple rollover image swap, but also changes another alternate image at the same time. It's always worked like a charm.Lately I realized that the script no longer works in IE, though it used to in older versions of IE (I think it stopped working in anything past IE 7). It still works fine in Firefox, Safari, etc.I haven't been able to find a good alternative for this script, so I'm really trying to get it to work again in IE, but so far no luck.
Here's the link to the actual script itself. http:[ur;l]....
View 1 Replies
View Related
Jan 8, 2004
Here is a quick menu hidden in a Mouse Gesture for additional navigation on a site or administraitive duties.
To activate the menu simply right click anywhere on the screen , hold the button down, then move the mouse down 50px's and release. This will display the hidden menu.
There are two parts to it, first the Style and Script....
<style>
.expanded {
position:absolute;
padding:1px;
font:Arial, Helvetica, sans-serif;
font-size:11px;
text-align:left;
background-color:#D4D0C8;
width:150px;
border-left :2px solid #FFFFFF;
border-top :2px solid #FFFFFF;
border-right :2px solid #999999;
border-bottom : 2px solid #999999;
}
a.expanda {
padding-left:15px;
padding-right:15px;
display:block;
text-decoration:none;
color:#000000;
}
a.expanda:hover {
background-color:#003366;
color:#FFFFFF;
}
</style>
<script language="javascript">
document.oncontextmenu = null;
document.onmousedown = doDown;
document.onmouseup = doUp;
var timerID = 1;
var ly;
var ny;
var targ;
function doDown(e)
{
clearTimeout(timerID);
document.oncontextmenu = null;
var rightclick;
if (!e) e = window.event
if (e.which) rightclick = (e.which == 3);
else if (e.button) rightclick = (e.button == 2);
try
{
if (e.target) targ = e.target.getAttribute('id');
else if (e.srcElement) targ = e.srcElement.getAttribute('id');
if (targ != "navlink") {document.getElementById('altnav').style.display = 'none'}
}
catch(e)
{
document.getElementById('altnav').style.display = 'none'
}
if (rightclick != false)
{
ly = e.clientY;
}
return false;
}
function doUp(e)
{
var rightclick;
if (!e) e = window.event
if (e.which) rightclick = (e.which == 3);
else if (e.button) rightclick = (e.button == 2);
if (rightclick != false)
{
if (!e) var e = window.event;
ny=e.clientY;
lytemp = ly+50;
if (ny>lytemp)
{
document.getElementById('altnav').style.display = "block";
document.getElementById('altnav').style.left = e.clientX + 2;
document.getElementById('altnav').style.top = ly+2;
window.status = "down menu";
document.oncontextmenu = fakecontext;
timerID = setTimeout("document.getElementById('altnav').style.display = 'none'", 5000);
}
}
ly = null;
ny = null;
}
function fakecontext(){return false;};
</script>
And the menu div to place inside the body tag. Edit this to act as the menu you would like. Remember that you can access the event.target if you want to have the menu dynamicaly effect things based on whats clicked.
<div style="display:none" class="expanded" id="altnav">
<a href="http://www.news.com" class="expanda" id="navlink"><div style="float:right;width:20px;text-align:left;">Ctrl+?</div>Option 1</a>
<a href="http://www.cnn.com" class="expanda" id="navlink"><div style="float:right;width:20px;text-align:left;">Ctrl+?</div>Option 2</a>
</div>
View 9 Replies
View Related
Apr 26, 2005
I was actually looking for a couple of alternate form field elements such as a drag bar or combo boxes. Is there something like that out there, even? (see ascii representation for example of what I mean) Code:
View 7 Replies
View Related
May 9, 2005
There are lots of JavaScripts and PHP scripts for making tables with alternating row colors. I'd like to know if there's a way to use JavaScript to give a table alternate row CLASSES.
My ultimate goal is to cut down on the html and gain more control over my table. I have a PHP script that gives me alternate cell colors, with different colors in each of two table columns. But it's just too complex to work with. Code:
View 3 Replies
View Related
Feb 5, 2010
I am building a display which is made up of a XHTML table, CSS styling and JS animation.
The effect I am looking for is for the (mutliple) cell's content to alternate between one word to another.
My initial idea was to build an array to count through the cell numbers like I have for another section of the board in this snippet..
var flsh = document.getElementsByTagName('td');
for (var i=0;i<flsh.length;i++); //flash alert cells
{
cell = !cell;
[Code]....
This code flashes some of the other cells each second, however for my alternating text I'm not sure what methods to use since .style.backroundColor wont suit this.
View 3 Replies
View Related
Mar 21, 2011
I have a project that I need to read some data from an XML file.
Something like:
However, since JS is a client side script so it can't read from client side, is there any alternate way to do this? I am thinking to create a "Data" class, and many "Data" objects, is this an elegant way to do it?
View 5 Replies
View Related
Apr 23, 2011
Basically i have a function that depending on which picture you click (one for "yes" and other for "no") it will make visible a textarea .
However right now if i click in "yes" it will display me the textarea for yes, and afterwards if i click "no" it will display both textareas, for yes and no. I want everytime i click on yes it will hide the "no" textarea and the same for when i click the "no" textarea, it will hide the "yes" textarea.
Code:
<!- * * * * * * * * * * * * O.S. Question * * * * * * * * * * * * * * * -->
Original Operating System ?</strong></span><div id="container">
<div id="left">
<img src="yes.png" onclick="document.getElementById('moreinfo22').style.display =
[Code].....
View 4 Replies
View Related
Aug 26, 2011
I am a little new to java script and jQuery so, if you can, please ignore my ignorance. I am creating a theme for Joomla and am calling in the website title using php. I would like so that every other word is a different color.
[Code]...
I would like to use jQuery to make every other word a different color in that specific span.
View 1 Replies
View Related
Jan 27, 2011
I have a javascript redirection with an alternate text for those who have javascript disabled.
It all works fine but before redirection the alternate text displays shortly. Can I prevent that?
Code:
I also tried to hide the text with an onload event, but nothing changes
View 3 Replies
View Related
Mar 13, 2011
Is there away to alternate DIV rows in a specific section. When I try to alternate the DIVs it alternates everything that is a DIV on the page. I want to just alternate a DIV table.
View 4 Replies
View Related
Oct 20, 2009
Code:
function stripeTables() {
if(!document.getElementsByTagName) return false;
var tables = document.getElementsByTagName("table");
for(var i=0;i<tables.length; i++) {
[code]....
how does the script know if odd is true or false? The script works, but I'm missing this one concept. Is "odd" a JS keyword or something?
View 4 Replies
View Related
Jul 8, 2010
how to loop alternate elements in JQuery starting from an given index. all the elements have same CLASS values.
View 2 Replies
View Related
Mar 7, 2007
If a iframe src link is not available, how can i provide a default
site or alternate site for the iframe to use?
View 1 Replies
View Related
Aug 3, 2010
I would like a table to have alternating an alternating color per row. I also want to be able to remove or add a row and preserve every other row has a different color.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
[Code]....
View 5 Replies
View Related
May 21, 2009
if there's some effect in JQ that we can use to simulate rollover. Usually when user hovers a mouse over a link/image it changes its src/ background to another one (for example arrow.png -> arrow_o.png). So users feels like it is highlighted or similar. But we always must have 2 images (similar ones). Maybe there's some effect that can simulate this highligting/hover for user so we don't need to have 2 images. I understand it will never be as good as alternative image, but still.
View 12 Replies
View Related