javascript

mechanize (python) click on a javascript type link

Hi, is it possible to have mechanize follow an anchor link that is of type javascript? I am trying to login into a website in python using mechanize and beautifulsoup. this is the anchor link <a id="StaticModuleID15_ctl00_SkinLogin1_Login1_Login1_LoginButton" href="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&...

JavaScript + onbeforeunload

Hello, I have a query regarding my application. Whenever user closes browser window accidentally I'd want to do some clean up operations before that. I have used onunload event but problem is this event is sometimes is firing and sometimes doesn't. What should I do, is there better way to handle such type of problem. ...

Parts of string in bold text

Hello I have a unordered list that contains <ul id="strip"> <li><a href="#"><span>This-is a test string</span></a></li> <li><a href="#"><span>This is without</span></a></li> <li><a href="#"><span>New-test</span></a></li> </ul> I need to bold the text before the "-", so in the first <li> "This" is bolded. I'm stuck in t...

Matching strings containing HTML with javascript.

Hi I am in a situation where I need to match two strings containing HTML.I I can not use exact comparison as the two stings may differ sometimes due to white spaces or something like   etc. I tried using replace( /[\r\n\t]/g, '' ) this solved my problem with the white spaces.But I am not sure , how can I compare string to succes lik...

Does anyone know how can I keep the Javascript variable even though the page has been refreshed?

Example: In the main page cliked on a button (NEW), the page then will using Javascript to open a new page in a new window by calling redirectPage(). In the main page clicked on a button (EXIT), then page then will call confirmExit(), then closeChildWindows() to closed all popup new window before redirect to another new page. However, ...

hide show div when multiple nested layers exist

function showlayer(layer){ var myLayer = document.getElementById(layer).style.display; if(myLayer=="none"){ document.getElementById(layer).style.display="block"; } else { document.getElementById(layer).style.display="none"; } } I need this code to close the current layer and them open another. These layers exist in the content div and...

Will search engines penalise text hidden by javascript?

I have this html code and want to use the text in the divs who are children to "divHiddenTexts" for a javascript slider and I want search engines be able to find the text. What I don't want is a penalty for hiding the text with CSS which is discussed in this question SEO : Is h1 tag that’s hidden using display:none given prominence by Se...

when importing multiple javascript files the javascript seems to break

I am trying to incorperate several different js files into one page. For some reason though whichever ones are first, seem to break. Here is the code I am using: <link href="inc/css/style.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" href="inc/css/lightbox.css" type="text/css" media="screen" /> <script type="text/javas...

How to build an OpenFire Client based on JavaScript and Flash

Since I played around with OpenFire Server, I started to make up my mind to build an IM Client connecting to this Server. So, I quickly do some research on this by looking for any library based on JavaScript with Flash. Unfortunately, I cannot find any. Does anybody know where to get source? Thanks! ...

escaping double and single quotes in jquery tooltip

Hello, I am using a dynamic jquery carousel to show thumbnail images in the home page....The carousel is working fine...and i want to add a tooltip to each image....for this i am using jquery tooltip....on hover tooltip should display the original image,uploaded by and so on... The javascript that adds the tooltip to each image is as f...

how to assign a javascript variable to a smarty variable

Hello all, I got a problem regarding how to assign a java script variable to a smarty variable. Here is the code snippet. function getDateInfo(date, wantsClassName) { var as_number = Calendar.dateToInt(date); //This as_number is the variable which should be assigned to smarty variable } How can i accomplish t...

How To find Out if Element is Wrapped by jQuery?

Hi How can i find out if an Object is Wrapped by jQuery. var obj = $('div'); if(obj is a jQuery wrapped object) { then do something } I am quite new in the Javascript World. Thanks in advance. ...

Dojo: Copying a node tree

I'm using Dojo as JavaScript framework. What I would like to do is copy a tree of nodes and put it under the copied tree. Specifically, I have a table row with plenty of code within it. I would like to add a new table row that is the exact copy of the above row, with some ids changed here and there. What would be the best way to do this...

select all checkboxes command jquery, javascript

Hey people I'm trying to get all of my checkboxes to be checked when clicking a link looks like this: <a href='javascript:;' onclick="$.overall.selectAll();">select all</a> inputs in a loop: <input type="checkbox" name="delete[$i]" value="1" /> jquery code: var checked_status = this.checked; $("input[name=delete]").each(func...

Options added to <select> by javascript lost in postback

I added some options to the select element by javascript in client side and cannot get it in postback. What should I do? Code used to add options: <asp:DropDownList ID="ddlProduct" runat="server"></asp:DropDownList> var ddlProduct = "#"+"<%= ddlProduct.ClientID %>"; $(ddlProduct).append($("<option></option>").html(product_name) ...

Problem with DWR and Android-Browser

Hello everyone, I am experiencing a problem with accessing an application from the Android-browser. The application uses DWR to persist connections to the clients that are connected with it. Everything works fine for me, except that if the application does not send any data to the client on the Android-phone for 2 minutes, the connecti...

javascript taking # marker literally

Hi, I have some code on some of my links <a class="nav_bu" onclick="switchType('all'); return false;" href="#"> when I click on them, I get fowarded to mydomain.com/# (404 error..). How can I get the function activated, rather then the href link. P.S. I have mod_rewrite running, is this screwing things up? Here are the rules that e...

jQuery - Check which divs are visible - fade function not allowing for immediate checking ?

THE SITUATION i have a series of divs setup to contain various content: <div id="main"> <div id="about"></div> <div id="contact"></div> <div id="flickr"></div> <div id="twitter"></div> </div> I also have a nav which fades in and out specific divs from above (using either the animate or fade functions). THE PROBLEM...

Constructor inheritance; what am I not getting here?

I'm trying to understand inheritance in Javascript, but this code (tested in Firebug) doesn't work the way I'm expecting. What am I not understanding about it? var A = function(v){ this.v = v || 'foo'; } A.prototype.shout = function(){ alert(this.v); } var B = function(){}; B.prototype = new A; var test = new B('bar') test.shout()...

executing anonymous functions created using JavaScript eval()

I have a function and its contents as a string. var funcStr = "function() { alert('hello'); }"; Now, I do an eval() to actually get that function in a variable. var func = eval(funcStr); If I remember correctly, in Chrome and Opera, simply calling func(); invoked that function and the alert was displayed. But, in other browsers...