javascript

How to access the elements in <script> inside the body tag

Hi All, I am using <script> inside the body tag. <script type="text/javascript" language="javascript"> $('#audioVolume').text($('#audioVolume').text(Math.round((document.mediaPlayer.Volume + 2000) / 10) + "%")); </script> Error: Microsoft JScript runtime error: 'undefined' is null or not an object. Need: I want to access the html e...

The best way to parse HTML tags in java-script

can anybody help/advice that is there any way to parse HTML tags appear in side the <body>...</body> tags ...

Match any word which contains a particular string of characters

I apologise in advance for the poor title of this post. I'm trying to match any word which contains a certain string of characters i.e. if I wanted to match any words which contained the string 'press' then I would want the following returned from my search, press expression depression pressure So far I have this /press\w+/ which m...

Loading/Displaying large amount of data on webpage.

I have a webpage which contains a table for displaying a large amount of data (on average from 2,000 to 10,000 rows). This page takes a long time to load/render. Which is understandable. The problem is, while the page is loading the PCs memory usage skyrockets (500mb on my test system is in use by iexplorer) and the whole PC grinds to a...

jQuery insert element and overwrite

To empty a div and replace it with an image I am using: $(this).html(''); $('<img/>', { src: 'blah.gif' }).appendTo(this); Is there a better way to do this? *edit: I have to keep the $('<img/>' part in otherwise I could just do $(this).html('<img src="blah.gif">'); I know!! ...

Using two xmlhttprequest calls on a page

I have two divisions, <div id=statuslist></div><div id=customerlist></div> The function sendReq() creates a xmlhttprequest and fetches the data into the division. sendReq('statuslist','./include/util.php?do=getstatuslist','NULL'); sendReq('customerlist','emphome.php?do=getcustomerlist','NULL'); I have a problem, The data fetched in...

javascript windows "Yes/No" asking twice?

I am using below code for javascript window "Yes/No". It is firing twice. Is there any way I can avoid this? Or use any other code?. I need this code behind. Response.Write("<script language='javascript'> { self.close() }</script>"); ...

Set text based on Form <select> value

I have the following <select> in a form: <select style="width: 100px; text-align: center;"> <option value="email">Email</option> <option value="telephone">Phone</option> </select> The default option is Email so the following <input> is show: <p class="email_form">Please supply your Email Address</p> <input onfocus="if(!this._hasc...

Popup window won't close until I click the alert shown on the parent page

So the child popup window won't close until I click the alert button, however, when I use the resize method for the child, it resizes before it shows the alert. Here is the code on the parent page: function ClosePopup(objWindow, strMessage) { objWindow.close(); //objWindow.resizeTo(30, 30); if (strMessage != '') { alert(str...

jQuery UI sortable: how to emulate the 'beforeStart' event?

Hi guys, im using the jQuery UI sortable plugin for sort some tall fieldsets (~300px height). My goal is to hide the main content of that fieldset, keeping visible just the legend tag (that is actually the sortable handler)... the problem is that, as you can see in the standard events of the sortable plugin, there is the beforeStop but ...

How to avoid nested functions when using AJAX?

Sequential Asynchronous calls are gross. Is there a more readable solution? The problem is this is hard to follow: ajaxOne(function() { // do something ajaxTwo(function() { // do something ajaxThree() }); }); where the anonymous functions are callbacks that are called on server response. I'm using a third party API to ...

Google MAP API v3: Center & Zoom on displayed markers

I use the following code to set markers on my map: var latLngs = [] $.each(locations.markers, function(i, m){ var myLatLng = new google.maps.LatLng(m.latitude, m.longitude); latLngs[i] = myLatLng var marker = new google.maps.Marker({ position: myLatLng, map: map, shadow:...

Checking the size of file before uploaing it

Is there is any way to check file size before uploading it using javascript? ...

Script tag in ASPX page is written partially (output stopped at random)

I have an aspx page where I put a script tag with .net "if" and "else". The problem is that the output gets cut at random points each time. Sometimes it's ok, sometimes I get cropped output. The code itself (Simplified example): <body id="body" runat="server"> <form id="form1" runat="server">some HTML <script type="text/javascript"...

JavaScript Regex Problem

Hi all; Csharp Regex Pattern: Regex rg = new Regex("(?i)(?<=>)[^<]+(?=</TD>)"); JavaScript Regex Pattern: var pattern = (?i)(?<=>)[^<]+(?=</TD>); var result = str.match(pattern); Csharp Regex pattern work, but javascript regex pattern not work pls help ? ...

Javascript: Change li class if checkbox is selected (on load)

I have this code on javascript side: function changeSelectionStyle(id) { if(document.getElementById(id).className != 'yes'){ document.getElementById(id).className = 'yes'; } else{document.getElementById(id).className = '';} } And this on html: <ul> <li id="selectedAuthorities-4_1li" class=""> <input ...

Javascript - Simple form script to hide/show fields

Im looking for a simple script in javascript that i can extend, at a basic level Im looking to show 1 field based on which option from a <select> the user chooses. <select id="options"> <option value="spoon">Spoon</option> <option value="form">Fork</option> </select> if select=spoon { <input>enter your favorite soup</input> } el...

Insert EBCDIC character into javascript string

I need to create an EBCDIC string within my javascript and save it into an EBCDIC database. A process on the EBCDIC system then uses the data. I haven't had any problems until I came across the character '¬'. In EBCDIC it is hex value of 5F. All of the usual letters and symbols seem to automagically convert with no problem. Any idea ...

get the src from img tag

I am using ajax to grab a page. withing a table lies an imagesrc i want to grab.. It is wrapped around an A tag with a class name i use the following $response.find(".infobox tr").each(function(){ $a=$(this).find(".image").html(); } but it returns the image tag <img src="http://uwww.domain.com.au/image.jpg" height="333" width="256"...

Javascript - .toJSON

Hi folks, i am newbie to JSON & hence i am not sure what $.toJSON(params) means? Please explain what this does? TIA ...