I'm used to just using getElementById to look stuff up in my own scripts but I'm doing an assignment and it would not look good to put id's everywhere to modify a html page when there are already name attributes in the elements.
In this page I can't refer to the Family Name input box using document.form1.familyName for some reason. Is it because it's inside a table after the form is opened? What syntax should I be using? Code:
I am using a js calendar script that populates a text field with a date. When clicking in the field the calendar shows then i choose a date, calendar closes, the date is now in the field. great it works fine.
I want to make this call from a button. when adding the code to a href, the popup shows but nothing happens when selecting a date. I have tried the following scripts will failure.
*html a href and img tag left out* onclick="if(self.gfPop)gfPop.fPopCalendar(document.this_form.elements['example[]']);return false;"
Rules: create an array for the user to type 5 strings in a prompt that will be displayed in an alert box.
User must type in the prompt an alert will display what the user typed if the prompt is empty or contains nothing an alert will display telling the user to enter text user clicks ok on the alert box and is sent back to the prompt box
I want to check if in a email textbox form field, email has correct syntax, but for Mobile Browsers, in desktop I used below, this will work foe Mobile Devices too?or better check this on server side(PHP)...(check second snippet)?
function checkFormtemplate() // javascript used success desktop browsers { if (document.getElementById("email-login").value == "") {
I feel like I must be missing something simple but I can't put my finger on it...
I'm moderately new to JS (programmed in other languages though) and am working on a Google Maps project.
This piece of code should show an alert of the region's name when a map polygon is clicked. Instead, no matter what polygon is clicked, it only does the name for the LAST iterated placemark. code...
What am I missing? What would be a better way of handling this?
I wrote a simple code in javascript and it is working fine with IE and Firefox but the out put in php array count is correct in IE but not correct in Firefox
<script language="javascript"> var arrdimensions = { "codimesion":{"s":{'0':'dimesion1','1':'dimesion2','2':'dimesion3','3':'dimesion4','4':'dimesion5','5':'dimesion6','6':'dimesion7'},"c":1,"m":"50", "sc":1, "f":"nopcs[]"} }; function adddimensions(what) { [Code]...
[URL]..Default.aspx I have both a carousel with images andalso animagemap(notnot published yet)with coords that when clicked i want to write to a cookie file which image or image map coordinate was clicked, so when they are hyperlinked to the next page the correct div opens based on first reading the cookie written to on the previous page. Anybody have a basic script for reading and writing to a cookie using jquery in this fashion?
Is there a way in Javascript or Jquery to return an array of all objects underneath a certain point, ie. the mouse position. Basically, I have a series of images which link to various web pages but I have a large semi transparent image positioned over the top of the other images. I want to find the href of the background image that the mouse pointer clicks over.
i'm a newbie on jquery i'm studying it with the latest version, and following a book called "Learning Jquery" but iencountered a error, and i don't know what the problem is:
i copied the code from the book like this:$('a[@href^="mailto:"]').addClass('mailto'); to try to change the links which start with "mailto" to the new class "mailto" but there's a error reported: uncaught exception: Syntax error, unrecognized expression: [@href^="mailto:"]
I'm facing the bug about the failure of innterHTML while reading xhtml content inside a DIV, in fact it has passed as html removing the closing of some nodes. Is there a way to read the content of the div perfectly how it is in the page, kind of:
var obj = document.getElementById("myDIV"); var realContent = obj.toString();
I'm working on recreating a paper form as accurately as possible in XHTML. I can't keep my sanity with that man DIVs, so I'm using nested tables.
In most fields (TDs) I have a label and a text box, and I'd like to have the text box fit the width of the TD as accurately as possible, without going on to another line. As far as I've heard, the only way to do this is using JS to get the width of the TD and the label, and then adjust the width of the text box to fit.
I'm using FireFox 3.0.11 for development. For some reason, the width of the TDs is being reported incorrectly. I've tried .width, .style.width, .offsetWidth, .clientWidth and .scrollWidth. They all agree within a few pixels, but are horribly incorrect. My current screen resolution is 1400x1050, and I've taken a screenshot and measured that to confirm - the actual width of the TD is approx. 1130 pixels, but it's being reported by all of those JS functions as +/- 865 px.
None of the tables or TDs have widths defined, it's all just automatic sizing. The only width/size defined at all is an overall div with 2% margins on each side.
Now, I prefer, and think that Markup A, is the better representation of the data... but... I can't find a spec, that dictates which one is "officially" correct... (due in part to the fact that in old HTML days, the closing tags were not needed... thus the confusion as to "where" that closing tag goes, when nesting)
This gets very interesting in the JS/CSS world, trying to deal with this...
If I generate Markup A, then get a reference to the LI element for "Item 3", called say... foo then I ask for foo.followingSibling, in Mozilla, I get as expected, the UL element, but in IE, I get the LI for "Item 4"... IE "moves" the UL node, to the .lastChild position of the preceding LI element.
So, here's the questions...
1.) Which method (by vote, spec or whatever) is correct/better? Method A or B?
2.) Based on (1), is the IE implementation a Bug, or a Feature? Mozilla's?
3.) If you want to style the sub items, what CSS would you use for Method A, or B... or does it matter?
PS I don't expect a unanimous answer to any of these, I'm just trying to get a feel for how everyone else interprets how Nested Lists are "supposed" to work.
I'm trying to figure out how to make this work and I'm stumped. I wrote this code:
<script type=text/javascript> function firstfunction(); { if(document.form1.inputnumbers.value="55"); { document.form1.outputstate.value="this is a number"; } [Code]..
I'm trying to doing something really simple but I can't seem to make it work. I'm trying have the textarea display a certain message depending on if the first input box says a certain word or number. So like in the code, if the user types "55" or "never" in the first box, then the second box should say a certain message. Then I used the else statement so that if "55" or "never" is not entered, then the second box says nothing. If you can spot my error or suggest a different way of going about writing the code
I have a table which I would like to be highlighted with the click of a button, but I can't seem to reference it correctly. I can make the <td> clickable and function, but when I try to apply it to the button I can't make it reference the td cell, rather than change the background color of the button.The function is:
I've created a script that should display a certain image based on the day of the week and the time of the day. After uploading the page to the site I receive no errors, however I'm not getting the display I should be seeing. It always returns the image from the final "else" statement. I'm thinking the problem is that I have two "&&" operators in each "if" statement, and I don't have the proper syntax, or perhaps I'm not writing it properly. Code:
I want to create a link to an email conference which is on 2 servers. Some users will only be registered on server1 and others will be registered on server2. however I don't know which users are on which server.
Is it possible to create some kind of JavaScript function which attempts to open a link to server1 and then if this fails default to server2. It would be far more user friendly.
Im required to use global arrays to create a currency converter website. As it is my code works perfectly, although im a bit unsure of whether i've used the arrays properly.Heres my arrays and the first line of code to convert GBP to Japanese Yen...
<script type="text/javascript"> //Global Arrays var strCurrency = new Array(5);