Search Results

Search found 23794 results on 952 pages for 'serverside javascript'.

Page 122/952 | < Previous Page | 118 119 120 121 122 123 124 125 126 127 128 129  | Next Page >

  • How to use window.location.replace javascript?

    - by william
    My URLs http://www.mysite.com/folder1/page1.aspx http://www.mysite.com/folder1/page1.aspx?id=1 http://www.mysite.com/folder1/page1.aspx?id=1&dt=20111128 Redirecting Page http://www.mysite.com/folder1/page2.aspx I want to redirect from page1.aspx to page2.aspx How to write a javascript in page1.aspx? window.location.replace("/page2.aspx"); window.location.replace("../page2.aspx"); window.location.replace("~/page2.aspx"); First 2 gave me this. http://www.mysite.com/page2.aspx Last 1 gave me this. http://www.mysite.com/folder1/~/page2.aspx What is the correct way to use?

    Read the article

  • Javascript to detect where newly opened window came from

    - by teggy
    Let's say I have a page, http://mydomain.com/mypage.html, with a "Back to page" link. This link should take the user back to the page where they came from only if the previous page URL matches one of the following: http://mydomain.com/one.html, http://mydomain.com/two.html, and http://mydomain.com/three.html. Otherwise, it would take the user back to the homepage, http://mydomain.com. I would like the "Back to page" link to also take the user back to the homepage when http://mydomain.com/mypage.html is pasted onto the browser. How can i accomplish this with Javascript. Thanks!

    Read the article

  • Advantages Of Putting HTML in Javascript

    - by user1609376
    I am wondering if it is better to put your html in javascript or in your html files. For example having my js file have this $('<div>').addClass('test').append( $('<p>').text('test1'), $('<span>').text('test2'), $('<span>').text('test3') ).insertAfter( $('#test1') ); VS My html file looking like this <div id="#test1"></div> <div class="test"> <p>test1</p> <span>test2</span> <span>test3</span> </div> and the js file have: $('.test').show();

    Read the article

  • What is the correct way to fix this Javascript closure

    - by sujoe
    I have been familiarizing myself with javascript closures and ran across this article http://blog.morrisjohns.com/javascript_closures_for_dummies.html Due to the closure, Example 5 does not work as expected. How would one modify result.push( function() {alert(item + ' ' + list[i])} ); to make the code work? function buildList(list) { var result = []; for (var i = 0; i < list.length; i++) { var item = 'item' + list[i]; result.push( function() {alert(item + ' ' + list[i])} ); } return result; } function testList() { var fnlist = buildList([1,2,3]); // using j only to help prevent confusion - could use i for (var j = 0; j < fnlist.length; j++) { fnlist[j](); } } testList(); Thanks!

    Read the article

  • Change div order in CSS or javascript

    - by Sam Holder
    say I have layout like so: <div id="main"> <div id="NormalContent"> {some content which is a fixed length list} </div> <div id="FeaturedContent"> {some content which may contain a long list} </div> </div> and I want to place FeaturedContent above NormalContent. Can I do this with CSS? I assume I can with Javascript?

    Read the article

  • Java Wicket - Calling javascript ( JQuery ) before AJAX

    - by user1428051
    I got this thing i'm trying to solve: I got a ListView created using Wicket ( 1.5 ) with a lot of elements and a scroll. When new items are available, the user is asked if he would like to refresh the list via a message backed by an AjaxLink: public void onClick(AjaxRequestTarget ajaxTarget) { /* do something ... */ ajaxTarget.addComponent(_list); } So on click the list gets reloaded and the scroll position is reset to zero. Is there any way i can call JavaScript before the list reloads the save the scroll position? (I know how to get/save the scroll position ( .scrollTop() ) , i just don't know how to call a function right before AJAX ).

    Read the article

  • How to execute an exe using Javascript?

    - by Karthick
    I need to open an EXE from a folder, when the folder is present, using javascript. I have added the code, but am not able to open the EXE after checking the folder, please share your thoughts. <html> <body> <script language="JScript"> <!-- function checkfolder() { var myObject; myObject = new ActiveXObject("Scripting.FileSystemObject"); if(myObject.FolderExists("\\tmp")) { alert("tmp Folder Exists"); } else { alert("tmp Folder doesn't exist"); } } --> </script> Check for folder "tmp" <form name="myForm"> <input type="Button" value="Check Folder" onClick='checkfolder()'> </form> </body> </html>

    Read the article

  • Send value to servlet with javascript

    - by kawtousse
    hi everyone, In my JavaScript function I do like this in order to redirect parameters to servlet: var ids1=document.getElementById("projet").value; document.location.href("http://localhost:8080/Opc_Web_App/ServletAffectation?ids1="+ids1); and in the servlet I do the following to get Value: String idprojet= request.getParameter("ids1"); System.out.println("le projet selectionné est :" +idprojet); the problem that i didn't have the result of System.out.print in my screen; so in other terms the servlet didn't get the parameter. I can not see the problem until now. Please help. Thank you.

    Read the article

  • Selecting a portion of a JSON array and applying variables in javascript or jquery

    - by user1644609
    I am retrieving a JSON file that returns its results like what you see below. The JSON has 365 days worth of data. I would like to create "views" of this JSON using javascript, one which pulls the last 10 days, then 1 month, 6 months, etc. After the getJSON function I am doing this to get a string as JSON, then turn it into an object and will then graph it. So I would like each "view" to be an object for the specified timeframe (using the one JSON). The obj_10days, obj_1month, etc variables would then be plotted. var $ graph = data ; var obj = $ . parseJSON ( $ graph ) ; JSON: [ { "Low": 8.63, "Volume": 14211900, "Date": "2012-10-26", "High": 8.79, "Close": 8.65, "Adj Close": 8.65, "Open": 8.7 }, { "Low": 8.65, "Volume": 12167500, "Date": "2012-10-25", "High": 8.81, "Close": 8.73, "Adj Close": 8.73, "Open": 8.76 }, { "Low": 8.68, "Volume": 20239700, "Date": "2012-10-24", "High": 8.92, "Close": 8.7, "Adj Close": 8.7, "Open": 8.85 }, Any help is appreciated, thank you!

    Read the article

  • Javascript if/else statement in iframe

    - by gr33nh4t
    So I'm trying to use javascript to pop up a video, and need to know when I'm in an iframe so I can resize the video accordingly. When outside the iframe, I see three alerts ('this is seen by both', 'not in iframe', and 'this is after the fact') When in the iframe, I just see the first alert ('this is seen by both'). var handleViewVideoClick = function (dataAction, eventType, targetElement, dataActionElement) { alert('this is seen by both'); if ($('iframe', window.parent.document).length == 0) { alert('not in iframe'); } else { alert('in iframe'); } alert('this is after the fact...'); }; What's going on here?

    Read the article

  • javascript code to prevent screensaver from starting

    - by gertjan
    Hi all, I am completely new to javascript programming and I have a question that I didn't manage to find an answer for anywhere. I have recently put together a simple slideshow to view the photos remotely that I host on my home computer. This by itself works fine. The problem I run into is that when I'm viewing photos I don't interact with the hardware, which after some time causes the monitor to switch off. This is particularly annoying when watching photos on my mobile phone. My question is: is there a way to prevent this from happening? I am thinking in the direction of faking a mouse or other event every time I refresh the photo, but I have no clue how to do that and if it is possible. Any help is greatly appreciated!

    Read the article

  • Dynamically create Javascript object and give class

    - by George
    I'm dynamically creating option elements for a drop down menu using Javascript and would like to know how to add a class to them so that I can style them with CSS. I have the following code: for (var i=0;i<portfolio.length-1;i++) { portfolioSelect.options[portfolioSelect.options.length] = new Option(portfolio[i]); } where portfolio is an array populated by an outside source. HTML where options inserted: <select id="portfolio" name="portfolio"> <option selected="selected" value="Select One">Select One</option> </select>

    Read the article

  • Add method to Array in Javascript

    - by user1167650
    Is it possible to add a method to an array() in javascript? (I know about prototypes, but I don't want to add a method to every array, just one in particular). The reason I want to do this is because I have the following code function drawChart() { //... return [list of important vars] } function updateChart(importantVars) { //... } var importantVars = drawChart(); updateChart(importantVars); And I want to be able to do something like this instead: var chart = drawChart();<br> chart.redraw(); I was hoping there was a way I could just attach a method to what i'm returning in drawChart(). Any way to do that?

    Read the article

  • Comparing large strings in JavaScript with a hash

    - by user4815162342
    I have a form with a textarea that can contain large amounts of content (say, articles for a blog) edited using one of a number of third party rich text editors. I'm trying to implement something like an autosave feature, which should submit the content through ajax if it's changed. However, I have to work around the fact that some of the editors I have as options don't support an "isdirty" flag, or an "onchange" event which I can use to see if the content has changed since the last save. So, as a workaround, what I'd like to do is keep a copy of the content in a variable (let's call it lastSaveContent), as of the last save, and compare it with the current text when the "autosave" function fires (on a timer) to see if it's different. However, I'm worried about how much memory that could take up with very large documents. Would it be more efficient to store some sort of hash in the lastSaveContent variable, instead of the entire string, and then compare the hash values? If so, can you recommend a good javascript library/jquery plugin that implements an appropriate hash for this requirement?

    Read the article

  • Validate string in javascript with parenthesis

    - by user2932856
    I just need to validate 2 strings in javascript. One of them must contain only 0 or more open parenthesis ( . The other must contain only 0 or more close parenthesis ) . This means only those characters are allowed in each value. After spending a lot of time trying to understand the regex, I can't find a way to achieve this. With the escape characters I make a mess of the regex function. This is what I thought: /\(*/ Could anyone help me?

    Read the article

  • Documentation for JavaScript Event Hanlders.

    - by The Rook
    I am looking for a list of all JavaScript event handlers (such as onLoad, onSubmit ect...) and the corresponding html tags that they can be applied to. This is is the best document I have found so far, but I believe it is is incomplete. The W3 specs are even worse, all it says is "This attribute may be used with most elements.". All browsers have their own quarks, if you know of a document for a specific browser like Firefox or IE that would also be helpful.

    Read the article

  • need to loop through a PHP array in JavaScript

    - by user296516
    Hi guys, For example I have a PHP array, such as this one <?php $s= array('a','b','c','d','e','f') ; ?> And I need to loop through it in JavaScript, any ideas how do I do that? for ( i=0 ; i < <?php echo sizeof($s) ?> ; i++) { document.write('<?php echo $s [somehow need to get the 'i' value into here] ?>'); } Any suggestions? Thanks!

    Read the article

  • Javascript opens new window despite no call

    - by Jimmy
    I have a javascript that opens a new window for "PreChecking" a site. The problem is when i click the button, it works fine... but wichever i button i press next makes the method fire again, despite i doesn't call it. Its just the button with id "lnkPrecheck" that should call the method. Have searched far and wide for a slolution that just opens a new window for the lnkPrecheck button, not the others on the site. THere must be a way for only 1 of 3 buttons makes the function call, not all of them! The code: <asp:Button OnClick="lnkPrecheck_Click" OnClientClick="NewWindow();" ID="lnkPrecheck" runat="server" text="Precheck (Opens in a new window)" /> function NewWindow() { document.forms[0].target = "_blank"; }

    Read the article

  • [Javascript] Retrieve a URL of a frame

    - by Ricky
    Hi, guys: If I get a link <a href="/Users/ChangePassword.aspx" target="mainFrame"> in fraTopMenu, what (1) javascript can I add to get the current mainFrame's URL upon clicking the link and (2) append the URL to the querystrings? <frameset rows="60,*" cols="*" frameborder="no" border="0" framespacing="0"> <frame src="/Common/Manager/TopMenu.aspx" name="fraTopMenu" scrolling="no" noresize="noresize" id="fraTopMenu" title="" /> <frameset rows="*" cols="185,*" framespacing="0" frameborder="no" border="0"> <frame src="..." name="leftFrame" id="leftFrame" title="" /> <frame src="..." name="mainFrame" id="mainFrame" title="" /> </frameset> </frameset> Thank you.

    Read the article

  • Javascript running improperly?

    - by TruthStands
    I have a Javascript function that is called from the onchange method in a DropDownList. However I'm getting the error "Cannot have multiple items selected in a DropDownList." on line 14. This happens when the page is reloaded for other purposes. Why is it getting hung here when the method shouldn't even be getting called? Line 12: { Line 13: var hfSelected = document.getElementById("<%=hfSelectedValue.ClientID%>"); Line 14: var ddlExposure = document.getElementById("<%=ddlExposure.ClientID%>"); Line 15: hfSelected.value = ddlExposure.options[ddlExposure.selectedIndex].text + "|" + ddlExposure.options[ddlExposure.selectedIndex].value; Line 16: }

    Read the article

  • Operations in table data with javascript

    - by Zangrandi
    I'm working with rails and I don't know javascript. I have a table with a select_tag field and I want to have another field that capture the option selected, multiply for the price captured in another field and display the total. Like this <table> <tr> <td>(select_tag)</td> <td>price</td> <td>total</td> </tr> </table

    Read the article

  • Auto refresh of page in Rails 3 using javascript

    - by teknull
    I have a view in my rails app: blah.app/units/status This displays a status of all my units. I'd like to have the page automatically refresh via javascript but I'm not sure how to do it. I tried writing this but it doesn't reload: <script> $(function() { setInterval(function(){ $.getScript("/units/status"); }, 10000); }); </script> Can someone point out where I'm going wrong here?

    Read the article

  • Making a select choice result in a popup in javascript

    - by Ryan Johsonson
    So this is using javascript and HTML. For example: <select name='test' > <option value='1'> <option value='2'> <option value='3'> </select> If someone chooses option value 2 (from the dropdown) I want a popup to appear. However if they choose option value 1 or option value 3 (from the dropdown) I want nothing to happen. How can I do this? Thanks

    Read the article

  • VS JavaScript intellisense with paramaters

    - by TonyB
    here is some sample javascript: SomeObjectType = function() { } SomeObjectType.prototype = { field1: null, field2: null } SomeOtherObject = function() { } SomeOtherObject.prototype = { doSomething: function(val) { /// <param name="val" type="SomeObjectType"></param> var val2 = new SomeObjectType(); //val2. shows intellisense correctly //val1. does NOT } } Shouldn't visual studio be giving me intellisence when i do "val." inside the "doSomething" function? I would expect it to give me field1 and field2 as options, but it doesn't. I DO get field1 and field2 if I type "val2." so intellisence works when I create a new object of the same type that I specify in the param comment. Any ideas what I am doing wrong or is this just not supported?

    Read the article

  • Converting C# class to JavaScript

    - by AgileMeansDoAsLittleAsPossible
    Take a look at this basic class: namespace AcmeWeb { public string FirstName { get; set; } public class Person { public Person(string firstName, string lastName) { if (String.IsNullOrEmpty(firstName)) { throw new ArgumentNullException(firstName); } this.FirstName = firstName; } } } What's the best translation of this into JavaScript? This is what I'm thinking: (function(namespace) { namespace.Person = function(firstName, lastName) { // Constructor (function() { if (!firstName) { throw "'firstName' argument cannot be null or empty"; } })(); // Private memberts var _ = { firstName: firstName }; // Public members this.firstName = function(value) { if (typeof(value) === "undefined") { return _.firstName; } else { _.firstName = value; return this; } }; }; })(AcmeWeb);

    Read the article

< Previous Page | 118 119 120 121 122 123 124 125 126 127 128 129  | Next Page >