SEARCH YOUR SOLUTION HERE  

onClick doesnt work in Mac

I have this code, and it works fine in windows but not in mac, does anybody know why

function checkAgreement(to) { if(accept.checked == 1) { if(to == "photo") { window.location = "/index.phpoption=com_jwallpapers&view=submit&Itemid=18"; } else if(to == "video") { window.location = "/index.phpoption=com_hwdvideoshare&task=upload&Itemid=25"; } } else { alert("You must first read and agree to the terms and conditions above"); } } Submit a Photo Submit a Video

I even tried a return false; at the end of the onclick but still nothing.

Thank you,
Musya
This post has been edited by musya: 07 October 2009 - 03:35 PM

Posted On: Sunday 23rd of December 2012 11:59:39 PM Total Views:  269
View Complete with Replies




Related Messages:

Combining two onclick events....   (82 Views)
all, I need to add webtrends (web analytics) tracking to an onclick event which sends the user to a new page.. IconicTest Page Link Will the code above work
CHANGE EACH COLOR onclick EVENT   (88 Views)
hello, I want to develop a script which could change the each and every cell in a table when clicking. What i am considering to achieve this is by assigning each an id and use it as a function parameter, so that in function i could change the color of that particular cell. Something like this: Code: Untitled Document function changeColor(id) { var cell = document.getElementById(id); cell.style.background = red; //cell.style.color = black; } a1 but since onclick would not work for the so what else better way to perform this. If someone could suggest better alternative for achieving sucha a thing it would be very kind. Note: this to start my online movie ticket booking self learning project, so please guide me to the appropriate direction
------| QUICK HELP: Textbox onclick redirect to another page |--------   (95 Views)
So Basically I want to do this PHP Code: How can I do this
javascript onclick to update database   (69 Views)
I'm attempting to modify a facebook app I purchased that allows friends to send gifts to each other. The problem with the program is that when gifts are accepted, they continue to show on the "accept gift" page. I'd like to change it so that after gifts are accepted, they no longer show on that page, preventing the user from wondering "which gifts have I already accepted" Later, I'd like to also create a reject gift option, but 1st things 1st. The program is written in php, html, and javascript. I decided one solution was to add a new empty column to the sql table called "accepted". When the user presses "accept gift" I'm thinking an onclick event could be used to add a "y" (for yes) to that record in the database. Then modify the code that displays the gifts to only show gifts from the table 'WHERE' accepted is equal to null. My questions are: Is this a logical approach If so, is the process: create a javascript function that updates mysql and call that function with an onclick event What about sql injection vulnerabilities I've read a lot about ajax and HTTP request being the way to do things like this, but could not find an example that represented what I want to do. After weeks of reading, I'm still lost.
Button switch text and call different functions on onclick   (84 Views)
This button changes the button text when clicked, but it is always calling the same function. How to make the button depending on the button text to call different functions on onclick [CODE] function button_switch(){ if (document.switch_form.switch_b.value == "Adam"){ document.switch_form.switch_b.value="Eva"; } else{ document.switch_form.switch_b.value = "Adam"; } } [CODE]
Popup onclick doesn't launch anything   (90 Views)
Please delete thread, I went with a JQuery-based solution instead.
OOP - maintain prototype instances (this) beyond Ajax callbacks and onclick events   (119 Views)
I'm pretty new to Javascript and just started with some OOP concepts, so this might be an obvious one and I apologize if the question is much longer than it should be... Basically I am trying to create a reusable class object with several internal functions, that is completely abstracted, meaning the class object itself should never have to reference the global declarations or window object. This class should be aware of itself at any point in the execution of it's own functions, and that is what I'm having trouble with at the moment. What I'm trying to do is create reusable javascript "Apps" for my HTML web application, where multiple instances can be instantiated and used independently from one another. My main problem is "this" loses context in the Ajax callback and onclick handlers. I'm not sure how to persist the context of "this", or at least keep a reference to prototype instance itself. Let's set up a simple class called "App" to demonstrate what I mean... Code: var myApp = new App("MyFirstApp"); function App(argName) { this.name = argName; this.GetDirectory("C:\Program Files"); } App.prototype.GetDirectory = function(argPath) { // "this" equals the App object instance (good!), meaning this.name should equal "MyFirstApp" Ajax.GetDirectory(argPath, this.GetDirectoryCallback, this.GetDirectoryTimeout, this.GetDirectoryError); } App.prototype.GetDirectoryCallback = function(argFilePaths) { // "this" equals the "window" object (bad!), meaning this.name should equal a null reference // argFilePaths contains a string of file paths (delimited using ;) returned by the server var mFilePaths = split(argFilePaths, ";"); // for each file path, add a div to the document body containing that file path, with an onclick handler for (var i in mFilePaths) { var mFilePath = mFilePaths[i]; var mFilePathDiv = document.createElement("div"); mFilePathDiv.innerHTML = mFilePath; mFilePathDiv.setAttribute("onclick", "javascript:this.FilePathDivClickHandler();return false;"); document.getElementById("body").appendChild(mFilePathDiv); } } App.prototype.FilePathDivClickHandler = function() { // I need a reference to the App object instance here, but I'm not sure where to grab it... // what I want to do is call GetDirectory again, referencing the div's innerHTML which contains another file path, like this: this.GetDirectory(event.target.innerHTML); } The onclick handler using "this" is obviously not going to work because "this" is a reference to the "window" object which does not have a function called FilePathDivClickHandler(). So what I can do is nest the GetDirectoryCallback() function inside the GetDirectory() function so that GetDirectoryCallback() can reference the variables in the outer function (GetDirectory). Code: App.prototype.GetDirectory = function(argPath) { // "this" equals the App object instance (good!), meaning this.name should equal "MyFirstApp" // "this" will still lose context inside the callback, so we can set up a variable called "instance" that the callback can reference var instance = this; Ajax.GetDirectory(argPath, GetDirectoryCallback, GetDirectoryTimeout, GetDirectoryError); function GetDirectoryCallback(argFilePaths) { // "this" equals the window object (bad!), meaning this.name should equal a null reference // "instance" equals the App object instance (good!), meaning instance.name should equal "MyFirstApp" // argFilePaths contains a string of file paths (delimited using ;) returned by the server var mFilePaths = split(argFilePaths, ";"); // for each file path, add a div to the document body containing that file path, with an onclick handler for (var i in mFilePaths) { var mFilePath = mFilePaths[i]; var mFilePathDiv = document.createElement("div"); mFilePathDiv.innerHTML = mFilePath; mFilePathDiv.setAttribute("onclick", "javascript:instance.FilePathDivClickHandler();return false;"); document.getElementById("body").appendChild(mFilePathDiv); } } } Even though we have persisted the App object instance through the use of the "instance" variable in the outer function, the onclick event handler still does not work; when it fires, "instance" is an unknown object. Would placing the FilePathDivClickHandler() function inside the GetDirectory() function, much like what was done with the callback, allow me to use "instance" correctly for the onclick handler
How do I set an onclick event handler to call a function which requires a paramater   (95 Views)
, Is it possible to set an html element's (created through HTML DOM's createElement() method) 'onclick' attribute's value to a Javascript function which requires a parameter, passing a variable to it at the same time I have the following Javascript code: Code: var parentDiv = document.getElementById("subscribers"); var stubSpan = document.createElement("span"); stubSpan.id = "opentok_subscriber_" + stream.streamId; stubSpan.onclick = showStreamInFullScreenMode(stream); parentDiv.appendChild(stubSpan); 'stream' in the bolded line is a parameter variable of the function that the above code is in, and I'm trying to pass it to another function using an onclick event. Can this be done, or am I crazy to be even trying to do this
radio button onclick   (97 Views)
As the code example below shows, I have three radio buttons that perform an javascript action when selected. Code: function OnProductClick(product) { if (product.value == "Car") { // do something } else if (product.value == "Boat") { // do something else.. } else if (product.value == "Train") { // do else } } Select option Car Boat Train This setup is triggerred by a click, clicking multiple times on the same radio button will yield multiple calls to the OnProductClick function. This last part is what I would like to prevent. Say a user selects the option 'car' and then for some reason clicks on the same option again, this will lead to the OnProductClick function being executed twice. How can I prevent the second execution
Javascript onclick not working in IE   (74 Views)
, I am having troubles with my form not working correctly in IE. I have onclicks for different parts of my site. I am trying to use onclick and divs to make this happen. Can some look at my code and help me out
onclick event for a tooltip   (83 Views)
Hi I would like to use javascript to control what tooltip displays when a tab is rolled over depending on which tab was clicked. Code: Customer Info Order Phone: 7093521232 For example when the Customer Info tab is selected I would like the tooltips to be like above but when Order is the tab selected I would like the tooltip to say Customer Info Detail, Order Detail Screen, and Phone Detail. How could I use an onclick event to control what tooltip is being displayed depending on which tab is selected I have about 20 sets of customer info and sometimes not contains all of the tabs and I would also like to be able to add more customers.
onmouseover + onclick problem   (94 Views)
hi i have a problem coding a menu i have 4 links on menu and clicking on items should expand a DIV and change the menu item image. also rollover has to change the image too i mean 3 conditions for every menu item: normal, rollover, clicked. i have no problem with rollover but when item is been clicked and image changes, image has to change on mouse over again, but has not to change to original image on mouse out. also clicking on another menu item has to change the previous item image to original. i'm confused enough i tried by samples over and over. but the main problem is that i dont know js syntaxes and coding however, anybody could help
Changling Image and Text onclick   (70 Views)
Hi , I'm new to javascript but cannot figure out a way to do something or even if its possible. On the site there is an image with some descriptive text to the side, here is the work in progess link to the site for an idea www.igrey.co.uk/nbe I want to be able to click the arrows and the text and images change so you can scroll through a couple of different projects
pure javascript image slider with onclick   (88 Views)
i am starting a new project and need help please i will have a varied number of game covers and will need to scroll left to right smoothly and when end image out of screen ad a new one at beginning. i am sure this one has been made before but i want to try and build one i am stuck on the part where it needs to remove the image when it reaches the end and then add a new image at the start i get the feeling i am going about this all wrong but could somebody tell me the best way to do this and dont say jquery Code: function updateimagesright(i) { var positionofimage = document.getElementById("images").style.marginLeft; if(positionofimage.length==0){positionofimage = '0px';} positionofimage = positionofimage.substring(0, positionofimage.length - 2) i = parseInt(positionofimage); i = i + 5; var t = setTimeout(function () { document.getElementById("images").style.marginLeft = i + "px"; if (i < 600) updateimagesright(i); },10); } function updateimagesleft(i) { var positionofimage = document.getElementById("images").style.marginLeft; if(positionofimage.length==0){positionofimage = '0px';} positionofimage = positionofimage.substring(0, positionofimage.length - 2) i = parseInt(positionofimage); i = i - 5; var t = setTimeout(function () { document.getElementById("images").style.marginLeft = i + "px"; if (i > -600 && i > 0) updateimagesleft(i); },10); }
small problem changing a onclick   (92 Views)
here is what i have working Code: document.getElementById("myid").onclick = sale1; that works fine but i need to have the "1" as a variable like Code: document.getElementById("myid").onclick = sale+count5; sale being the name and count5 being the variable containg numbers. i need to combine the sale with the variable and change the onclick to that. any ideas
Using onclick to change image before changing URL   (149 Views)
Hi. When I click on an image menu link, I want to change that image before I change to another page. I have managed to change the image using the code below but am having difficulty getting it to change to another page. I need a small time delay before I change the page. Would appreciate any help and yes I do really need to do it this way. Many thanks [CODE] function reloadImage(imageName,btyp) { var str1 = "lev/images/"; document.images[imageName].src = str1.concat(btyp,".gif"); btyp=""; str1=""; imageName=""; } *** From inside the DIV ******
onclick event handlers   (76 Views)
hi, i need to be able to take the values from two text boxes and change the location of a sprite on my canvas, i've searched the internet and it doesnt really explain how to do it for me. here is my code: x: y: function ChangeCo() { } and i need the function to take the x and y values from the text boxes and change the values of my variables: var block_x; var block_y; block_x = 290; block_y = 70; Thankyou in advance
Insert Text in textarea onclick   (90 Views)
I have searched this forum for similar queries & have come up with this http://jsfiddle.net/defencedog/P33FR/ I don't know why this ain't working
Resolved Not recognizing onclick event   (86 Views)
I'm having an issue where a programmatic click event is not behaving the same way the cursor click event is. A cursor click returns the correct object from GetObject(). The programmatic click triggered by a USB device is returning undefined from GetObject(). How can this be resolved Edit: It appears that it does not recognize eval(document.getElementById(gButtonList[gButtonId])).onclick(); as an event. Why is this How can I get it to recognize it Edit2: Resolved it myself. See green text below. TestPage.htm: Code: function BuildButtons() { for (var i = 0; i < testArray.length; i++) { // Create Div [Buttons created programmatically] var divNode = document.createElement('div'); divNode.id = 'div' + i; divNode.onclick= ClickFunction; etc... } } function ClickFuntion(nodeButtonNum) { alert(GetObject()); Returns the index for a cursor click. Returns undefined for the programmatic click triggered by the USB device } function GetObject() { var node = event.srcElement; return node; } USBHelperFile.js: Code: This JS file works with a USB hardware device that can navigate through divs and click them when they have focus. function HelperFunction(keyCommand) { switch (keyCommand) { case: "click": //eval(document.getElementById(gButtonList[gButtonId])).onclick(); var target = eval(document.getElementById(gButtonList[gButtonId])); target.fireEvent("onclick"); break; } }
Create calendar textfields onclick problem in Firefox   (88 Views)
I have the script below working fine in IE but not FF, can any one help me The script creates new fields with calendar in a form, if new information is added to a field and then a new field is created the information is lost in FF Live demo: http://hotelendenia.com/sandbox/ Code: Calendar Text Input function extend(m, e){ var e = e || this; for (var x in m) e[x] = m[x]; return e; }; function create(type, opt, parent){ var el = document.createElement(type); if (opt.style){ extend(opt.style,el.style); } delete opt.style; extend(opt,el); if (parent){ parent.appendChild(el); } return el; } fields = 0; function add_input(){ document.getElementById('input_container').innerHTML += ""+ fields +" "; fields += 1; } add input
Table row's onclick to show/hide an embedded Div   (91 Views)
I have a php page that essentially builds a pay report in the form of a table. The php side builds the page properly, though it took some time to get the table rows onmouseover and onmouseout functions to work for row highlighting. Now the issue is the table row's onclick function. Here is what the outputed html looks like. Code: function HideShowDiv(divID) { if (document.getElementById(divID).style.display == "none") { document.getElementById(divID).style.display = "block"); document.writeln("show "+divID); } else { document.getElementById(divID).style.display = "none"; document.writeln("hide "+divID); } } Georgetown Youth Baseball Association James Beach 1 Game(s) $22.5 owed Cut Check Game Date Teams Fee 2011-08-06 Marin vs LBF \$22.50 John Carpenter 0 Game(s) $1.5 owed Cut Check Game Date Teams Fee 2011-08-06 Assigner Fee \$1.50 Some Association of Baseball \$24 In my javascript function, the writeln() calls are for testing to see if the even is even firing. but nothing gets written to the page. Any thoughts on this would be greatly appreciated. Basically I want the row with the users name to be clickable which will show the details in the hidden div associated with the user.
onclick event   (70 Views)
forum, My name is juan and recently started html programming. I have a web page with a drop box with the name of states. Code: Alabama Alaska I can add a onclick="code here" to the tag so that when the drop box alabama is selected it triggers the onclick event. Im using Ibox in order to have a image of the state open. Code: the above is a link tag correct How do I go bout adding the above code into the onclick event
No Longer Resolved- Why doesn't this work? (onclick, buttons, and textboxes)   (85 Views)
(EDIT: THE INFO ABOUT THE CODE IS THE SAME, BUT SEE NEXT COMMENT FOR NEW, UPDATED CODE) , I'm trying to create sort of a quiz in html/javascript. The objective is to have rows of two textboxes, one in which you can type and one in which you can't. A button would be present, labeled Check, and when clicked, it would display the correct answer in the disabled textboxes. Another button, labeled Clear, would reset all the textboxes' values to just a space. For clarification in the code, textboxes labeled with ANSWER are the greyed-out ones that display a value when the Check button is clicked. The textboxes labeled with GUESS are the non-disabled ones. Both get reset when Clear is clicked. This code isn't working correctly on http://htmledit.squarefree.com/. Can someone help (by the way this is a Latin verb quiz, for all you classics majors out there ) Code:
Links within sub-div, parent div has onclick event - Problems   (77 Views)
I have a parent div, that when hovered over changes the background color. There is a onclick event so that a user can click anywhere within the div for the link to work. Inside that div I have another div with unique links. When I click on any of those links, it also activates the other onclick event. I don't want this. :-/ Here is my code Code: Wednesday - January 3rd, 2007 08:00am - 08:30am Blah George I'm guessing I need to create some type of function that will detect where the click came from and then decide whether to fire it or not Thank you in advance for your help.
how to change onclick to checkbox?   (75 Views)
Hi Guys, How could I change Code: Continue to Code: Continue or to Code: Continue Code: function processForm() { $.ajax( { type: 'POST', url: '
Image onclick question - I can't figure this out   (142 Views)
I need some help here. I'm a complete newbie at this. This is what I would like to have happen. Upon clicking an image (button) I would like a new window to open and I also want to the parent window to load as a new page. I've been searching around and found some code. I implemented it and got the new window to open, but the parent window does not change. Please let me know what to change. Here's what I have:
iPhone Launch video and trigger onclick at the same time   (106 Views)
I have a video on a page, which on a pc or mac, will play inside a standard flash player. On the iphone, I have setup javascript to detect iphone / ipod, and replace the flash player with an embedded m4v file: Code: if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) { $('div#vid').empty(''); $('div#vid').html(''); } So far so good. I also want to trigger a simple onclick which makes an ajax call a remote PHP file. I have tried ontouchstart instead (see above code) but still no luck. If I add the onclick to a static image rather than an embed instance, it works fine. But with the embedded video, it's as if the video blocks the onclick event for javascript to pickup. Does anyone know a way around this
onclick to keyboard   (68 Views)
, Does anyone know how you might use the onclick event to type a letter from the keyboard Something like this Many
Generated divs and their onclicks don't work IE8   (80 Views)
all, First I apologize if this has been answered. I did a quick search on the forums but found nothing that related entirely to this issue, also did a google search and found no entirely relevant posts. For those posts I did come across I tried various hacks (including holly hacks and setting background-colors) but nothing worked. I'm not a web guru, so please feel free to pick apart and make suggestions for my code. I have a table style div. Now I'm aware that table-style divs are in no way supported by any IE yet, so I have a CC that implements similar layout for all the IEs. My issue is that this div is generated by javascript on jQuery's document ready. The div has a bunch of row divs, and below that it has cell divs. The cell divs are generated with an onclick attribute before they appended to the row divs. This works in all browsers except IE. This code occurs in a for loop that creates a row and then inserts 7 'day divs' (where the row represents a week). Code: var thisDay = document.createElement('div'); if (curMonth != viewMonth) { thisDay.className = 'JSCalViewNCMD'; } thisDay.innerHTML = curDay.toString(); thisDay.onclick = "javascript:JSCalendarHandleSelection(this,'" + tarcal.inpTag.getAttribute('name') + "'," + curDay.toString() + "," + (curMonth-viewMonth).toString() + ");"; thisDay.setAttribute('onclick', "javascript:JSCalendarHandleSelection(this,'" + tarcal.inpTag.getAttribute('name') + "'," + curDay.toString() + "," + (curMonth-viewMonth).toString() + ");"); //dayDivs.push(thisDay); curEl.appendChild(thisDay); curDay++; if (curDay > curDayLimit) { curDay = 1 curMonth++; if (curMonth === 12) { curMonth = 0; curYear++; } curDayLimit = JSCalendarGetMonthLength(curMonth); if (curMonth === 1 && curYear % 4 === 0) { curDayLimit = 29; } } This is the resulting generated HTML that IE developer window reports: Code: June 2010 S M T W T F S 23 24 25 26 27 28 29 30 31 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 2 3 However the onclicks do not fire! No errors are generated by my code in any of the browsers. The code works in the most up to date firefox, chrome, opera, and safari for windows. I'm at a loss at what to do now...
prototype   (124 Views)
Does anyone knows how to work with prototype ajax class , cause I think this class has everything and there is no use of rewriting the code s !!!
More Efficient Substitute For Eval Function?   (91 Views)
all! I just watched a tutorial on writing efficient javascript code and it told me to avoid using the eval() function because it is inefficient as far as speed. It says to try to use an anonymous function instead, but I can't seem to get an anonymous function to do the same thing I want an eval() to do when it comes to changing a property of an object. Here is the eval() function I currently have that works(from Dreamweaver): function MM_changeProp(objId,x,theProp,theValue) { //v9.0 var obj = null; with (document){ if (getElementById) obj = getElementById(objId); } if (obj){ if (theValue == true || theValue == false) eval("obj.style."+theProp+"="+theValue); else eval("obj.style."+theProp+"='"+theValue+"'"); } } This successfully changes the properties of stuff. How can I have a function that does not use the eval() function which changes properties successfully I tried writing an anonymous function, but I couldn't get it to work.
Iframe issue or google issue ??   (98 Views)
Guys i was loading google.com in iframe till now!!! but from 2 days its not loading!!!!! any suggestions , and if theres any alternative to iframe please let me know .
jquery 3d carousel   (158 Views)
hello friends... I'm new to jquery and as well as to daniweb :P I'm learning jquery from 3 days using online tutorials... I am given a task by my guide... For which i want to know why is it that the jquery carousel on the page http://web.enavu.com/demos/3dcarouselwip/ works in firefox and chrome but not in IE can anyone help me on this
java script help 2020   (88 Views)
I see code but no question!
Center Div in Browser   (268 Views)
A requirement for the project I am currently working on is that when various links on a page are clicked that the appropriate "layer" (i.e. div) will be displayed centered in the browser. I have tried using various javascript solutions and they center some div's and not others. Does anyone have an example of a way to show and hide a div that is centered in the browser no matter where the div is located in the html Any html/css and javascript code examples greatly appreciated!
brief walk through AJAX??   (251 Views)
daniweb users, i would like a brief walk through on AJAX if you'll can, i already looked through the post and didn't find what i was looking for, i would like to know how to refresh evertying on a web page but the header, which contains the navigation bar that way only the content info is refreshed,
Dynamic list of tagged posts, tumblr   (327 Views)
. Been searching all night for a way to do this, so thanks in advance for any help forthcoming. I'd like to be able to create a list of post titles that share the same tag in tumblr (rather than a list of tags). Tumblr allows you to filter your posts by tag by typing in a url, but this brings up a full page of posts, and I'd just like a list of the titles that I can then use as a menu. Hope this all makes sense. I'd imagine this is fairly simple as the capability to filter by tag already exists, but I cannot for the life of me work out how to do it.
Whether it is possible to find the response url in?   (247 Views)
I have a problem as following... # I have stored some value in session to reach a Page "A" # I have other pages "B", "C", "D". # If I am moving from Page "A" to "B", I should not clear my session value but If I am moving from "A" to "C" or "A" to "D", then I have clear some values in session. # I have clear it on body unload of "A" on condition. Is there any way to find the URL which I am landing via javascript Is there any other way or work around to solve this problem. Note: I have menu in my left frame and content in right frame. my links to move from "A" to "B", "C" and "D" are in menu.