OnClick To Load Defaults Into Some Of Subforms?
Jun 29, 2010
I have a long form and I have some checkboxes that do a onclick and show and hide the sub forms. This all works just fine but i want to onclick to also load some defaults into some of the subforms. Most of the fields in the sub form are drop down boxes. Below is my code to hide and unhide the tables I would like to just add to this code so I can just pass it a variable to change the defaults of said table.
function check(tableId, ctrl){
document.getElementById(tableId).style.display = (ctrl.checked) ?
"":"none";
}
If I make no sense on what I am asking for I will try to explain more.
View 14 Replies
ADVERTISEMENT
May 31, 2007
I thought I had this licked. How do I load a file with an onclick AND replace the current page with another page?
<span return true">
<img border="0" src="../img/ok.gif" width="30" height="30"></span>
View 6 Replies
View Related
Aug 25, 2010
I use jQuery for loading ajax content, changing css etc. I want to make button that does something similar to "Refresh" - changes back all css changes to defaults.
Is there a function that could do this?
View 2 Replies
View Related
Oct 24, 2009
There appears to be no difference between these two when the page loads.
<select id="one">
If there is no "selected" then it always defaults to first value.
How can I tell if the page has loaded and no options have been selected?
View 2 Replies
View Related
Oct 23, 2010
I have a form and am calling the insert into page using ajax. However when I click on submit my welcome page, set as my default page is called.
Looking around I think possibly a 401 is being generated by my Header and so it is being set to my default page.
So I guess my questions are:
1. Is this the most likely reason or when you look at my script does something else spring to mind?
2. How would I test to see if I am right (I tried getHeader but I don't think I understood how to set it out properly)
3. How would I resolve this.
My code is:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html>
<head>
[Code]....
View 6 Replies
View Related
Mar 2, 2010
How can I create argument defaults for a function? I have this function (the purpose of the lines I included were to set defaults if the user forget to input something simply to prevent an error.
Code:
addHSLink = function (hsElem, hsUrl, hsType, hsTitle, hsWidth, hsHeight) { //hsElem[string], hsUrl[string], hsType[string], hsTitle[string], hsWidth[string/number], hsHeight[string/number]
var jQElem = $(hsElem);
if (typeof hsUrl !== 'string') {
hsUrl = '[URL]';
} if (typeof hsTitle !== 'string') {
hsTitle = '';
} if ((typeof hsWidth !== 'string' && isNaN(parseFloat(hsWidth))) || hsWidth !== 'number') {
hsWidth = 800;
} if ((typeof hsHeight !== 'string' && isNaN(parseFloat(hsHeight))) || hsHeight !== 'number') {
hsHeight = 600;
}
//Some other code
}
I would like to save some programming space and time by finding another way to set defaults. I saw somewhere that you could set a default in the arguments list
Code:
function someFunction(aVariable = false) {
//some code
}
But when I try to do this with all my arguments, I get the error:
"Missing ) after formal parameters".
View 4 Replies
View Related
May 15, 2009
My jQuery-Plugin shoud produce two buttons with a onclick-event.Problem:The onclick-event got fired, when I call the plugin, without clickingon the button.Why got the click-event fired without clicking the button?Here my (shorted) plugin:
(function($) {
$.fn.rte = function(options) {
$.fn.rte.defaults = {
[code]....
View 2 Replies
View Related
Jul 20, 2005
I am very new to JS and trying to use a button to move on to a new html page
rather than a text link. The code I have is as follows; (having tried to wrap the button in a HREF)
<A HREF="index.htm">
<input type='button'
id='Button2'
name='Button2'
style='width:146px;height:46px;border:1px#000000
solid;background-color:#FFFF99;color:#000033;font-family:Verdana;font-size:1
0pt;'
value='INDEX'
onClick='return true;'[color=blue]
>[/color]
</input>
</A>
This does not work not sure why, I originally tried calling a js function
jsLoad() to load a new page but don't quite know how to do this?
<SCRIPT LANGUAGE=javascript>
<!--
function jsLoad()
{
don't know what to put here !!!!!
}
//-->
</SCRIPT>
View 2 Replies
View Related
Jan 7, 2011
welcome i have a little problem cuz i want to send $_GET data by jquery and then php file load into div$arm->fields - number valueThis is working:function executiveonclick="eqitemshow(".$arm -> fields['id'].")function
function eqitemshow(id) {
$('#eqitems').load('eqitem-load.php?id='+id);
$('#eqitems').slideUp("slow");
[code].....
View 3 Replies
View Related
Sep 22, 2009
I am trying to use an onclick statement to go to an alternate web page displaying a different version of tha file being displayed in the current page.
In the HEAD section of the current page I have a global variable named currentfile that contains a file name. This function is also in the HEAD section immediately below the variable's declaration
I have tried every combination I can think of in the onclick code to get it to work but, no joy. here is an example:
I just can't get the next page to load.
View 15 Replies
View Related
Jul 7, 2011
I have a script that I got from the net which allows me to change the content of a div by clicking an anchor link (I need the script because I have NO idea of javascript/ajax). I applied it to my test page so that when I click the blue horizontal menu (number and algebra link) the idea was that the left main menu would load from a div on another page (algerba.htm). However in the translation it does not work [URL].
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "[URL]">
<html>
<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Mathematics Learning Zone</title>
<meta name="description" content="Learn Key Stage 4 Mathematics and Achieve a Grade C.">
<meta name="keywords" content="Maths, Mathematics, Key Stage 4, Key Stage 4 Maths, GCSE Maths, Maths Grade C">
<meta name="author" content="Peter Devlin">
<script type="text/javascript" src="java/jquery-1.5.min.js"></script> .....
View 4 Replies
View Related
Apr 15, 2009
In the following scenario how can i make the onclick function to load the tracking code when that link is clicked? Also if the tracking code is stored in the same html file how do i prevent it from loading by default with the page. I want that code to be loaded only when the link is clicked.
This is the link : <a href=[url]
And this is the tracking code which calls an html file on a different domain:
View 2 Replies
View Related
Jul 2, 2011
Seems im moving on from the css forums to java (im scared). I am a keen learner but an absolute beginner to java. What i need to be able to do is. When a student clicks on a link in the main menu e.g number I need a something that can load the following two divs.
#contentwindow #three I already have jquery running on the page and all css is embeded for now if that is helpful. [URl]..
View 12 Replies
View Related
Apr 13, 2010
I have a stage (placeholder) on which I'd like to show (onclick) content of different format (e.g. .jpg / .mp4 / .mov / .gif).For the pictures it works fine with this script:
Code:
<script type="text/javascript" language="javascript">
function showPic (whichpic) {
if (document.getElementById) {
document.getElementById('placeholder').src = whichpic.href;
[code]....
View 1 Replies
View Related
Apr 20, 2010
I use following code to create an element and load data into it onclick:
("<div id="element" ></div>").appendTo('#content').load("grid.php");
The first time it loads very fast, 12ms.
I have a close buttons wich removes the element from dom: $("#element").fadeOut('fast').empty().remove();
The second time I execute the onclick event, the first code takes approx 1 second, so much slower. The php code execution time is the same as previously.
View 4 Replies
View Related
Jan 3, 2010
I finally got the below script working in Firefox and was really pumped about it until I realized it didn't load in Google chrome or Safari. What this script does is its a dual onclick event which makes a hidden div appear and loads an iframe within the now visible div. Here is the code, how to make this work in other browsers.
Here is the header code:
<SCRIPT type="text/javascript">
<!--
var state = 'none';
function showhide(layer_ref) {
if (state == 'block') {
state = 'none';
} else {
state = 'block';
} if (document.all) { //IS IE 4 or 5 (or 6 beta)
eval( "document.all." + layer_ref + ".style.display = state");
} .....
Here is the code on the page where a link click shows the hidden div and loads the iframe contained.
<p><a href="#" onclick="showhide('div1');return loadIframe('ifrm1', '[URL]');
">show/hide me</a></p></td></tr>
<div id="div1" style="display: none; position: fixed; z-index:4;
width: 1010px; height: 500px; left: 5%; top: 15%; background-color: #f0f0f0;
border: 1px solid #000; padding: 10px;"><iframe name="ifrm1"
id="ifrm1" width="100%" height="90%" scrolling="yes" frameborder="0">
Sorry, your browser doesnt support iframes.
</iframe><p><a href="#" onclick="showhide('div1')">close</a></div>';
View 4 Replies
View Related
Sep 7, 2009
I have a site which loads a couple of Jquery animations on a page load. What I cant figure out is how to play a .fadeOut animation on the content when a link is clicked and before the new page is loaded.
View 4 Replies
View Related
Sep 16, 2010
I'd like to place an AJAX call to load another SELECT menu in my form, and I'm having trouble finding a tutorial. For your Copying/Pasting pleasure :rolleyes:, here's an example button for which I'd include the onclick():
<button type="button" >Add</button>
And here's an example SELECT menu:
<select id="idNumber" name="weekday_1['workPeriod_new'][] >
<option value="1" >one</option>
<option value="2" >2</option>
</select>
View 10 Replies
View Related
Jul 7, 2010
I have a site which displays a selection of advert listings. We log the number of clicks each advert receives via ajax requests.The listings link to both internal pages on our site and external pages, hence the ajax - we cannot log the'clicks' by logging the requests on the destination pages as these are not all on our site for us to log. Also, I don't want to potentially get false positives e.g.from bookmarked pages - hence I am logging the actual clicks, not the requests on the destination.
All is OK in most browsers, but there is a problem with Safari (I am running Safari 4.0 on Windows XP running in Virtualbox OSE) but only where the destination is to open in the same window/tab (some listings go to a new window, some don't). I am logging clicks via an ajax request in the onclick event, which is working fine when the listing is to open in a new window, but it appears that when a new window is not to be opened, the ajax never gets sent.A have constructed the following minimal test case:
index.html
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" [code].....
Note the line commented '****' in index.html which cancels the action of the link. When this is not commented out, the ajax request is sent correctly. Without it (the desired situation) the ajax request never gets sent. Its as if Safari saves up the ajax requests to do later, but never sends them as the new page cancels all such 'saved up' actions.I am using the Safari web developer tools, but I have also checked this test case by checking the Apache logs. Note that as a test case I don't pretend that it will work in IE, but it should work in standards compliant browsers and has been tested on Firefox 3.6.6 and Opera 10.6. The Apache logs show that logger.txt is being requested, unless it is already in the browser cache.Possible workarounds I've considered, but would prefer to avoid:
On the site in question the only such links that currently open in the same window are internal, so I do have the option of logging safari clicks by logging these requests as opposed to clicks and checking the http referer on the server side. As this is not a very flexible solution as it relies on these specific circumstances, also relies on all other links successfully making a new window, and furthermore relying on http referer could result in false negatives I'd rather find a solution within the javascript.I haven't checked whether an asynchonous request would work, but I don't wish to do this anyway just in case there is ever a server problem that prevents the response coming back (note that for these purposes the response is actually superfluous - we are sending the server a message but don't need anything back). I also want to avoid the delay in sending the user to the destination - there is no point having to wait for a response we don't need.Lastly, and my prefered workaround unless I can find anything better, is to make Safari (only) open all links in a new window anyway.
View 1 Replies
View Related
Sep 4, 2010
I want to make it so that when I click on something, it changes what document.onclick does.
This is a simplified version of what I'm trying to do:
Code:
<div id="clickme" onclick="document.onclick = function(){ alert ('This should not be alerted on the first click'); }">Click here</div>
However, as you'll notice, the alert box shows up on the first click as well. The only way I have been able to get around this behaviour is to have the first onclick execute a timer that will then set the document.onclick after 1ms, however this seems very messy to me.
View 1 Replies
View Related
Dec 6, 2010
Here is what I'm trying to do but the problem is "source.html" is not on a server somewhere. I am running everything locally. $('#container').load(source.html #sourceContent) Is there a way to do this exact thing but with a local file?
View 3 Replies
View Related
Aug 29, 2010
I have a question about load(). I created a php script that simply returns <img src="something.jpg" class="myimage">
To test I created this code, the image loads fine and the mouseover works fine showing the alert dialog :
However, my trouble seems to be that if I bind mouseover to the class "myimage" nothing happens, like so :
Seems that the document would load the html first then the mouseover bound to the class (myimage) would fire off.
View 2 Replies
View Related
Feb 13, 2010
The code is supposed to generate this: PS: This is generated by a PHP Function that the Ajax Load Method Calls.
[Code]...
I've been noticing a lot of problems when loading these stuff, Sometimes I have to remake the HTML Tags because its not showing anything. Is there any option? I want it to load EXACTLY how it is, I don't know if this is some kind of protection for bad code, but if it is I would like to disable. But also, this code is really clean. no problem, I don't know.
View 1 Replies
View Related
Jul 14, 2010
Is it faster/more beneficial to have two snippets of code be generated by php at 2 different urls and then have a load function for each url? Or have the two snippets on one page, surrounded by id's and then load them that way?
View 1 Replies
View Related
Mar 3, 2011
I have a problem when trying to load an HTML5 element with Ajax (jQuery.load ()).Here is a simplified example of the problem.
Main page :
<!DOCTYPE HTML>
<html>
<head>
<title>Title</title>
<!--[if lt IE 9]>
[Code]...
View 5 Replies
View Related
Dec 1, 2010
Basically there are 2 elements on the target page that I would like to load into the calling page, but I would like to do it without making 2 calls to the page if possible.
View 11 Replies
View Related