displaying images properly maintaining its aspect ratio?
My requirement: ===========
I have a table with single cell (means single row and column). I have to display image inside this cell. But when I do so using the below mentioned statement, the image expands and cover the entire cell area.
In my form I have an email textfield. Whenever the user enters an email address the form gets automatically submitted using JavaScript. However, when a user enters in an email that contains an apostrophe eg:
Mc’Knight. I get a javascript error and the form never gets submitted.
Whoever allowed apostrophes to be valid within emails needs some talking to!
Anyway. I have just found out that this JS function I have been using and have no idea how it works does not allow emails with apostrophes in it. Does anyone know how to alter this code to allow apostrophes?
var pattern = new RegExp(/^(("[w-s]+")|([w-]+(?:.[w-]+)*)|("[w-s]+")([w-]+(?:.[w-]+)*))(@((?:[w-]+.)*w[w-]{0,66}).([a-z]{2,6}(?:.[a-z]{2})?)$)|(@[?((25[0-5].|2[0-4][0-9].|1[0-9]{2}.|[0-9]{1,2}.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2}).){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})]?$)/i);
I have to pass a certain number of parameters, extracted from DB, to a javascript function.Among them there are for example numbers but also descriptions as names and surnames
Code: <A href="javascript:doAction("+value+")"></A>" Where value is a set of parameters formatted for example in the following way:
we had someone write this script for us a few years ago and we thought it was working fine until this week. It uses javascript to generate a dependant drop down menu eg. Depending on what the user chooses in the first drop down menu, (in this case a manual/book title) the second drop down displays the chapter/category headings that are available within that manual and then the users uploads a file that appears under that heading.
If our user adds a chapter/category heading with an apostrophe in it the script quits and the second drop down does not display the corresponding chapter headings. We are storing the info in a mysql database and use php and javascript to extract the data/build the drop down menus. Code:
I have a situation where i need to locate a radio button by it's value and check it. The solution below works in all browsers. However, in IE 6 & 7 (not 8), if there's an apostrophe it blows up.It's happening for me in both jQuery 1.6.4 and 1.7.1. Here's an example. var diagnosis = "Huntington's Disease"; $(...).find('input[value="' +diagnosis+ '"]').attr('checked','checked'); I've tried diagnosis.replace("'","'") and that seems to have no affect.
I am trying to re-work some pre-written Javascript code at which I am a novice at (I'm more CSS, HTML, PHP...). I am trying to validate a form field for a Purchaser's last name while accounting for an apostrophe if they have one in their last name.
I bet it's something simple, but I still haven't been able to figure it out, or write it correctly:
function checkPurchaserName() { var err = false; var f = $(getApogeeElement('purchaser_name_first')); var l = $(getApogeeElement('purchaser_name_last'));
[Code]...
As an example. I started the purchasing process with the name "Patrick O'Malley".
At the end page where this validation occurs, they have (2) text boxes, one for "first name" and one for "last name". They must type the same exact name for purchaser that they did for applicant, so "Patrick", then "O'Malley"
In the folowing Input tag I am trying to get the apostrophe in "Friends" to appear and it almost works the way it is but when I first load the page the "" (backslash) also shows up. If I click in the field (onfocus) the words "Friend's Email" disappear as they are supposed to. Then when I click somewhere else (onblur) it comes back like this "Friend's Email" which is the way I want it to appear when the page first loads. Is this a browser problem or something else I am missing?
For my links I have two portions. The first is the regular href for people that don't have javascript can navigate the site and the next an onclick for those with javascript can load pages inline with transitions and have it stay in their history for Firefox. All a la that wonderful ajax stuff everyone knows about by now.
It seemed like a good idea at the time... Because it is stored in the #hash value these people can link another person that has javascript enabled as well to the page and have the page load. But that's it. So we have 96% some odd percent of users included.
There is going to be confusion that happens if someone sends a link to someone without javascript, since it will just load the home page.
From what I have researched.. the server doesn't pick up the #hash value (this is obvious since when you click on a link that's linking to a spot in the page, it's the browser doing the work). That's okay, the thing I want anyway is for it to pick up on the very first request via well.. something. The first request is when the server does do something and may have a chance to do something with a hash value.
So questions: 1. Can I manipulate the server into 'reading' this #hash value on the initial request and then put it through say.. php or mod_rewrite?
2. What about css.. this is another client end thing that could work, but I am completely lost when it comes to css and recognising hash values. Even if it just works for Firefox/MSIE/Opera.. well.. that's something as it's non-intrusive and ups the people that can access my site properly.
There is an option to post a noscript tag to notify users on the first load that their javascript is off.. but there's no way for php to also be smart and say "hey, there's a Hash value"... as it could, I would just load the page that way. Code:
If I detect an empty textbox, I fill it with a value ('Dad'). If I do this twice, the second time around IE 6 fails to notice that I've cleared the textbox again, thus leaving the textbox cleared. Is there a recommended workaround? Opera 7.23 is detecting the second deletion fine.
The purpose of my application is to require a website visitor to complete a form before participating in a search application. I have a specific reason for doing this with client-side javascript, but I'm not going to go into the explanation of "why."
Ideally, the visitor goes to http://www.hopelandinc.com/golf-homes.html. If they haven't registered in 90 days, they'll be redirected to a registration form. Once they complete the reg form, they'll have a cookie set (called "isRegistered") and be taken back to the golf homes page.
For testing purposes, it is not necessary to actually complete the form. You can go to the golf-homes.html page, which will set the regReturn cookie, and then bypass the form submission by going directly to http://hopelandinc.com/registration-thanks.html
In short, it ain't working. (IE 6 test).
golf-homes.html calls the function securePage() below, which sets regReturn and redirects to search-registration.html.
search-registration is a form that posts to an ASP script, then redirects to registration-thanks.html
registration-thanks.html calls the function addRegistrationCookie which adds the isRegisteredCookie, and then redirects to the value stored in regReturn.
I've been trying to figure out why it doesn't work all day, and can't find the problem. Hopefully some super-genius here will be able to help!
Here is the function I'm using to retrieve a cookie value ("regReturn") and redirect to a specified web page:
When formattedHtmlText is, say, "<STRONG><BUTTON class=placeHolder>[[ContAmt]]</BUTTON> text</STRONG>" the HTML is pasted properly and the UI is changed accordingly.
However, if formattedHtmlText is "<BUTTON class=placeHolder>[[ContAmt]]</BUTTON> text" the HTML is not pasted and there is no change in the UI.
I have a problem where I have to use jQuery.noconflict(), but I have no idea how to use it properly.I'm working with some richfaces elements which uses the richfaces jQuery version and the countdown plugin from keith-wood.name/countdown.html which need another jQuery plugin.If I include the files for the coundown, the countdown works but the modalPanels didn't and vice versa.
i looked in one of my other projects that i recently finished, and the code seems to be identical.Basically it should generate an array of Canvases where individual letters can be written. Later other javascript code will try to determine which letter was written (letter recognition).The error that i keep getting is "ChangeThisID is Null".
Here's something that I tested without the PHP and it worked ok. Now that I've introduced the PHP to the document it doesn't work. The PHP variable is not passing to Javascript properly. By use of some cleverly placed alert boxes, I figured out that the only thing that is getting passed forward is something called : "object HTML ImageElement"
Specifically, I assign the element ID the unique ID number of the record in the SQL database. The problem isn't with the ID numbers themselves: They are alphanumeric and unique.I think it boils down to one of two lines of code. Either this isn't working (about line 12)
function expander(RecordID){
or perhaps it is when I am calling the function (about line 66):
The PHP works (I can get the images to appear, so the connection to SQL and such isn't a problem). I am sure most of the JavaScript is good, too, as I said I had it all working prior to dropping in the PHP.Since I am not going from JavaScript to PHP I don't think I need AJAX. I just need the PHP to pass to JavaScript.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">[code]....
I have quite a complex form, for me anyway. The form is meant to submit, use checkForm to see if the fields all pass the validation and then submit and run the PHP script to send the emails. Now, it is sending the emails and the validation works but it is not redirecting to $NextURL like it should.
if$(edtApplicantAge){} is supposed to set $NextURL when the page first loads as $edtApplicantAge is taken from POST information submitted via the previous form. I have echoed this and when it first lands on the page the age does show up.
$edtEmail and $edtAge are actions for the two forms on my page. I have only put one on as I dont want to flood my post with code. If anyone could see something thats missing id be so grateful. I spent hours yesterday and just couldnt figure it. Ive got this working in 3 other variations yet can't figure out where im going wrong on this one.
I am having two divs with ids nav and navLinks, that contain unordered lists of hyper links. I am calling a onload function named displayID that accepts div's id as a argument/parameter (nav and navLinks) twice with different parameters. the function is firing only once with the parameter that i first specify, even though i call the function twice. Am i doing anything wrong in calling the same function twice with different parameters? Code:
I've got a page that shows a number of packages available for sale. Each package has a little description, and then a (sometimes long) list of features for each package. I thought it would be a good idea to let visitors hide the details for each package, so that they can see just the summaries together. So I borrowed some code (can't remember from where), which was designed for expandable/collapsible menu trees, and used it to show/hide the details of the packages.
The code works fine, but the only problem is that when you hide a section, the page doesn't resize itself. The text underneath moves up, but below that a huge empty space is left. The scroll bars should change to reflect the page's new (smaller) length, but instead they stay the same, and let you scroll through all the empty nothing at the bottom of the page.
I've tested the page is IE6 and Firefox 0.9 - I only have this problem in Firefox, in IE the whole page shrinks and the scroll bars change accordingly. Any suggestions? I though maybe I need to call some javascript function to refresh/recalculate the page - I tried using document.normalize() straight after the section got hidden, but it didn't help. Any other such functions that might do the trick?
I am seeking a easy to maintain and more importantly *working* way to pre-fetch images, so the pages I develop load smoothly without seeing the images kick in flicker as they usually do. Important - I need this to work on Internet Explorer 6.0+ and FireFox.
I am presently using at the head of the page,
pic100= new Image; pic100.src="./imageme.gif";
However, it doesn't seem to work on FireFox at all. I've tried different combinations with the URL path, but I don't know what I am doing wrong. Can someone please assist me with this boggle?
Can someone tell me where the problem here is? I can't get the "squared()" function to work properly...it supposed to put the squared value into the iframe area....