How can I make a drop down menu that are dynamically generated base on the value selected in another drop down menu? values in both menu will need to be from mysql query.
Here is my options select from my form. Its dynamically generated with php. Code: <select id="upgrade[]" name="upgrade[0]" onchange="javascript:calTotal(this);"> <option value="1">1</option><option value="2">2</option> </select><br /> <select id="upgrade[]" name="upgrade[1]" onchange="javascript:calTotal(this);"> <option value="1">1</option><option value="2">2</option> </select><br /> <select id="upgrade[]" name="upgrade[2]" onchange="javascript:calTotal(this);"> <option value="1">1</option><option value="2">2</option> </select><br />
Using javascript I want to get the selected value. Here is what I have, but its getting no where: Code: function calTotal(aVar) { var c = document.getElementsByName(aVar); c = c.length ? c : [c]; for(var i=0; i<c.length; ++i) { if(c[i].value==1)//I am getting undefined here { } } Is there a way to loop through an array of option selected like the one I have here?
If the user types "a" then the select box is populated with "Choose An Animal...", then the three three animals beginning with A. So far so good. But if the user selects say Albatross and then types the letter b then the option "Bear" is selected rather than "Choose An Animal". Although the code is sel.selectedIndex = 0; (not 1). How can I force the selected index to 0 when a choice has been made previously? Is this a bug - if so it is the same in IE and FF.
I am searching a solution to change a ComboBox by popup I have found this script on the web. Is it also possible to select the newVendor just after adding? Is this script ok or are there better solutions?
<script type="text/javascript"> <!-- function message(value){ if(value=="newVendor"){// New Vendor is selected var vendor = prompt("Vandor's Name",""); var elementSelect = document.getElementById('vendor'); try{ [Code]....
I have a strange problem that occurs in IE 7 and 8 and does not occur in Firefox or Safari.I'm dynamically adding class to a table row on a checkbox selection. A row contains some input fields that get enabled or disabled. If a row is enabled, it gets highlighted using selectedrow class. If it gets disabled, the class is removed:
I've recently started playing around with jQuery and the jquery-tmpl plugin. I've been fairly impressed with how easy it has been to get my sample apps to call a web service and populate the returned data using a template on my page using something like...
var rendered = $.tmpl("myNamedTemplate", data); $("#resultList").html(rendered);
What I'm currently having trouble understanding is how to get the html results of rendering a template into a string so I can use it with other APIs. I'm working with the Bing AJAX map control and various functions in it's API take HTML as a string parameter.
What I tried first...
var myHtmlTitle = $.tmpl("myTitleTemplate", data); pin.SetTitle(myHtmlTitle);
That didn't quite work like I expected and resulted in an exception from the BING map control. I quickly figured out that what .tmpl was returning was not a formatted HTML string, so it makes sense that would fail.
I then tried appending .html to things and I got close...
var myHtmlTitle = $.tmpl("myTitleTemplate", data).html(); pin.SetTitle(myHtmlTitle);
This did in fact return an HTML string, but the problem is it was stripping off the top-level tag in my template. It's acting like it's returning innerHTML of the top-level tag.
Is there an easy way to simply render the template to a string so I can pass that into the APIs?.
I am loading a list of answers give by a specific user into a tab panel. To do this I'm using the following code: $('#questionBody').load('dashboard/questions'); All the html elements not from a loop such as a header image show up fine but the list of answers looks like it's displayed similar to when you use print_r() on an array. Is load() the proper function to use here?
here's an example of the output: {"status":200,"data":{"questions":[],"params":{"page":false},"user_answers":{"13":{"flagged":"0","regdate":"1282869034","id":"13","qid":"9","body":"an answer of course...","payed":"1","question":{"id":"9","title":"test","body":"test","uid":"1586","permalink":"/question/view/9"},"status":"complete"},"11":
i am wondering, what is the best way to render HTML on a page using an ajax request that gets the data as an XML file?
Say for example you wanted to load the comments on a particular news post, and wanted to pull this data in via ajax, and you server returns an xml with the commens in it, for example:
[Code]...
and then take that xml file and use it to render a list of comments, with profile pictures (worked out from the `profile_id`). I ask as i can do this easy enough by just making the server return the output as HTML, then placing it inside a container for the comments, but this is slower as the html output would be much bigger in size then the xml output.
I also need the ability to add a callback function so i can make a popup display if there is an error, or run a function that does something after the data is loaded. Ideal'y id like to load the html template which i would use along side the xml file, via ajax, but this isnt completely neceserry.
I am looking for a javascript function that can log the following information for each pageview:
1. The total page rendering time (not php script execution time, but the time at which the entire page is rendered from the user's perspective - all images loaded, ads served etc)
2. The URL of the page
3. The browser used to access the page
4. The country the page was accessed from
The script should then store the information in a database via an AJAX call after it's been collected.
It sounds like a tall order, but it will help me get a picture of how fast or slow my site feels depending on where you live (e.g. how far you are from the server), what browser you're using, and which pages are the slowest to render (keep in mind this is not script execution time or query time, but literally the time at which the page starts to render, to when it finishes rendering).
I'm writing a blog. When a user clicks the make comment link under the comments section for a blog entry, a div pops up with the form that allows them to make a comment. I would like to use XMLHttpRequest to point to a php file that posts the comment, and then display the comment underneath the others that are already there...
This is my first real experience with Javascript in 8 or 9 years, and I've forgotten it almost entirely. I'm working off of tutorials that I'm finding here and there, and have already gotten the XMLHttpRequest to perform the posting of the comment, but I don't know how to write the comment to the end of the comments list without refreshing the page.. Code:
Is there a javascript or jQuery method available to force the browser to render the contents of the window? This would something similar to updating the "stage" in Director or Flash.I have a two-column interaction set up where users input information in one column and see their results in another. Safari, Firefox, etc all work perfectly. IE however needs an extra click anywhere on the browser window for the results to appear. So I'm looking for a way to attach a function to a UI control that 'forces' IE to render the screen so the changes appear.
I have a nice javascript slideshow but it kills the rendering speed of my home page. According to Yahoo performance guru(s), javascript gets run before other stuff is rendered, so you fix that by putting the js code "at the end" of the html file.
Putting it at the end puts the slideshow at the bottom which is not the desired result. And even abs positioning is slave to the <div> structure.
How do I nullify the flow just for this one thing (I don't want to make the whole page absolute).
I am trying to find how to use custom tags in html and render data based on their use.
A good example is the joomla <jm:whatever> tag.
I found the following article: [url]
I think it might be outdated though because the behavior:url element does not seem to work. Plus, when I check the style sheet on a joomla site, it doesnt seem to use this method. I think these tags might be xml but I do not know how to render them based on the tag.
For example: <customAbbrv:display src="test.html" label="Test" />
I would want this tag to fire test.html and pass the attribute label which is set to Test.
I have a JSON file with multiple containers that has built a webpage. I need to create a javascript from this file to render a page since it was written to use a js library (I think scriptaculous or doj). I want to use jQuery to do this -- at least that's what I'm told I can do. I understand that JSON is a data-exchange language like XML. Here's some code:
Code: var nov_info= { 'categories':[ {N:'nwItem1',O:'Composition',V:School Supplies > Paper> Notebooks}, {N:'nwItem2,O:'Crayons',V:'Elementary > Art > Art Supplies'}, {N:'nwItem3',O:'Calculators',V:'High School > College Prep> Trigonometry'}, {N:'nwItem4',O:'Maps',V:'Middle School > US History > Civil War'} ], [Code]....
I want to use MathML or maybe javascript graphics and essentially create a real-time math preview. So I want to have a text box where you insert your source code, and I want the preview box to update automatically. For example, say I want the preview box to refresh every time the user enters a space character. Is there a way to get only the new source code entered to render in the preview box without having to re-render the entire preview every time? For example, if a user types 2x^3, I want the math equivalent to show up in the preview window. If a user then types in " + 2x" I want just the " + 2x" part to be drawn right next to the already-drawn "2x^3".
Is this possible? Or is the only way to re-render the entire preview every time the user types in a new term? I would like to only change what the user has edited. If a user edits the middle of the math, then I have no choice and have to re-render everything after what the user has just edited, but when the user is editing the math at the very end, can I not just tag it on to the end and render just that little piece?
I'm using the following code to remove an option from a select control based on a selection in a different select control and the option text in the select option that is being removed. The code works as I want it to, but I would prefer to use the option value for identifying the option to remove instead of using the option text. I've tried several different ways to do this, but can not find the proper syntax.
I have an select option list, each option has a numerical id, value and text. Each option has an array of its own. So when I choose an option from this list, I want to insert the options array into another option list with an id, value and text. Whats the best way of doing this? How do I select an array based on the value or text of a select option? For for example, take a list of car makes. If I choose the make Audi, how do I select the array of Audi models and insert these models into another select option list. All makes and models have their own numerical id, value and text.
Is there a way in Javascript, or perhaps in HTML, to force a browser to re-render an image on an HTML page after a round-trip between the client and the server ?
In my particular case, the image is changing on the server although the URL for it remains the same, but the browser is still displaying the old image from its cache rather than the new image from its URL location.
I wish to have options show or not show depending on the options selected previously. I think I would be right in saying this needs to be client side and think it must be javascript that is needed here. Either way what method should I use and what is the coding needed to do this. <!DOCTYPE HTML PUBLIC "-W3CDTD HTML 4.01 TransitionalEN"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head><body> <form action="" method="get"> .....
After toying around for a while with the <canvas> object in HTML5 I came to the disilluding conclusion that text won't render the same smooth way as HTML5 text. Have a look for yourself. The more you magnify the view the more the difference becomes evident:
http://kmt.hku.nl/~walther/test/test2.html
is there any way to achieve the same rendering of text on a canvas than with plain HTML?