javascript

Send Email Confirmation on SWFUpload

Not sure if too many of you are familiar with SWFUpload. It's a flash/js/php based uploading script. My main issue is that I'm decently fluent in php where I can create a simple mail() script, however, with the various JS files I'm not sure if it'd be better to create the mail function in JS. If anyone has had experience with SWFUpload ...

jQuery simple ajax request not working

Hi all! All I want to do is get a page and return the contents of it: $.ajax({ type: "POST", url: "alg.aspx", data: sqQstring, success: function(msg) { alert("Data Saved: " + msg); } }); This doesn't make an alert box and there are no errors i...

"Drupal is not defined" Javascript error and drupal.js gives "Page not found" error

I'm installing Drupal like I've always done and I start to see this error in the console. I know Drupal object is defined in drupal.js, so I open up the source file and click on /misc/drupal.js and it says "page not found." Huh. That's weird because I can see that file is in my system, just where it should be. But somehow Drupal cannot f...

Incompatible Type

I am trying to input validation of a form but when I debug my code the the debugger gives me an error of Incompatible Type. My code is below. if(frm.input.value<'a' || frm.input.value>'z' || frm.input.value!='@' && frm.input.value!='.') { alert("Not a valid E-mail adress"); } ...

Change the HREF of a link loaded through an XSL Variable? (JQuery)

Hey people. I have some JS/JQuery code that when a certain variable is present, to change the HREF of a button to an XSL variable call. It doesn't seem to be working, IS this even possible, or am I just doing it wrong? Sample: if(h == '2') { $('#nextBtn').attr('href', '{$next-file}'); $('#backBtn').attr('href',...

Form which generates image in real-time

Hi, I am looking to build a form which updates an image in real-time. Could someone help me out and tell me the best way to go about creating a form similar to this (languages, techniques, etc): http://www.demonplates.com/platebuilder.php Where as you enter details the image is updated accordingly. The form will send to google checkout...

how to create yes/no/cancel box in javascript instead of ok/cancel?

How to create a yes/no/cancel alert box instead of ok/cancel alert box in Javascript? ...

How to overlay images in javascript?

Hello! I need to solve the following problem. I have two (or more) .PNG images of the same dimensions. Each PNG image is created with transparent background color. I need to display img1 and upon it img2, so in places where img2 has trancparent color, img1 will be seen. For example: img1 upper part filled with transparent color and a...

window.clipboardData.setData and BOLD text

Is there a way I can make window.clipboardData.setData (javascript code that works in IE only) store text that is formatted? I can figure out new line breaks, but I'm after bold/underline/italic text. I'm sure there are differnt types of encodings to do this, I'm just not sure where to start looking. As the text is intended to be post...

How to validate an email address using JavaScript?

i am trying to doing input validation its my complete code but it is not working well. <html> <head> <title>Testing Validation</title> <script type = "text/javascript"> function getvalue() { value = document.getElementById('myId').value; if(value < 'a' || value > 'z' || value != '@' && value != '.') { alert("Not a...

jQuery zip masking for multiple formats

I have a requirements for masking a zip field so that it allows the classic 5 digits zip (XXXXX) or 5 + 4 format (XXXXX-XXXX). I could so something like: $('#myZipField').mask("?99999-9999"); but the complication comes from the fact that dash should not be showing if the user puts in only 5 digits. This is the best I came up with s...

One click handler for multiple buttons and stop propagating event up to parent?

Hi, I'm generating a bunch of "li" items as a result of an ajax call. They look like: <li> <p>Hello result 1</p> <button>remove</button> </li> <li> <p>Hello result 2</p> <button>remove</button> </li> ... can I create a single click handler that will get called when any one of the "li" item "button" elements gets clicked, ...

Global jQuery `.click()`

I would like to fire an event when anything on the page is clicked, and then process normally. For example a click would be fired, I would see if the target matched something, alert if it did, and then have the click event continue (no preventDefault()). ...

Facebook like : Uncaught TypeError: Object #<an Object> has no method 'provide'

I have recently added the facebook like button, but the following code returns an error in chrome: Uncaught TypeError: Object # has no method 'provide' <!-- Facebook --> <div id="fb-root"></div> <script> window.fbAsyncInit = function() { FB.init({appId: '121814204514513', status: true, cookie: true, xfbml: true}); }...

Selecting an option in a dropdown menu based on node value?

Is there a way to set the value of a dropdown list in jQuery (or Javascript) based on the node value? <select name="ddlProperty"> <option value="1" selected="selected"></option> <option value="2">Animal Kingdom</option> <option value="3">Epcot</option> <option value="4">Hollywood Studios</option> ...

Create master checkbox outside {foreach} tag

Hello, I have dynamic page under {foreach} tag something like this. <div id="c1"> {foreach} <input type="checkbox" name="checkbox" id="{$num}" checked/> {/foreach} </div> which in return prints something like this. <div id="c1"> <input type="checkbox" name="checkbox1" id="1" checked/> <input type="checkbox" name="checkbox2" id="2" c...

Multiple replaceWiths in jQuery?

Why doesn't this work? What would be a plausible solution to get this effect? $(document).ready(function() { $('#myLink1').click( function() { $('#myLink1').replaceWith('<a id="myLink2" href="#panel2">#panel2</a>'); }); $('#myLink2').click( function() { $('#myLink2').replaceWith('<a id="myLink3" href="#pa...

Determine actual viewing size in browser

I am trying to determine the actual viewPORT size of the current browser window. I've tried: window.innerHeight/innerWidth document.documentElement.clientHeight/clientWidth document.body.clientHeight/clientWidth All return the full page size and NOT the viewing area. What I'm trying to ultimately achieve is forcing a popup menu to...

what is the difference between .last() and :last ?

Can someone explain the difference between .last() and :last ? I can't seem to find a definitive explanation. Why Exactly does this $('td.cellsOfSpecificClass:last', '.table tr') return the last td in each tr instead of the last td in the whole table? ...

[javascript/html] how to know at which character it changes to another line in a textarea?

Coz i have not earned 10 reputations that i cannot post image here, please click here to see my example textarea. There is no ENTER at the end of the first line and is there any solution to know at which character it turns to next line? Take this for instance, it turns to next line after the character "哪" or after the 13th character. (S...