I'm writing a web page in ASP.NET. I have some Javascript, and I have a submit button with an onClick event.
Is it possible to call a method I created in ASP with Javascript's onClick event?
Hello, I am posting this question for the third time because never got correct answer. I want to open 2 windows on 1 click. Don't tell me to use window.open twice because I want to open one javascript banner i.e.
''
and one website that can be any like google or yahoo and it can easily open with window.open but how can I open the banner which is in the javascript code with second site?
Today I was looking for website optimization content and I found an article talking about move JavaScript scripts to the bottom of the HTML page. Is this valid with W3C's recommendations?
I learned that all JavaScript must be inside of head tag...
Thank you.
I have a string generated by php's json_encode() that looks like this:
[ { "key1":"value1",
"key2":"value2",
"key3":"value3"
},
{ "key1":"value1",
"key2":"value2",
"key3":"value3"
} ]
I use Javascript function to convert the string to Javascript object:
var jsonObj=JSON.parse(string);
How do I access the data inside since the inner objects have no names? I tried something like:
alert(jsonObj.firstChild.key1);
It gives me "undefined". Why is that so?
I have quite a number of user controls that I need to embed in Umbraco macros. Each user control has quite a bit of in page javascript that needs loaded into the page.
I have been building up the javascript with StringBuilder.Appendline then registering a startup script with code behind but this stinks and I feel there has to be a better way of going about this.
Has anyone any ideas please?
Thanks,
B
Hello,
I am using the ExternalInterface to communicate between Flash and JavaScript using callbacks and the call method. I would like to throw an exception in ActionScript 3.0 and catch it in JavaScript and I was please wondering if there was anyway to do that?
Thank you very much,
Rudy
Hi,
I would like to open a webpage and run a javascript function from within a java app.
For example I would like to open the page www.mytestpage.com and run the following javascript code:document.getElementById("txtEmail").value="[email protected]";submit();void(0);
This works in a browser...how can I do it programatically?
Thanks!
Hi, I am wondering if there is a Javascript equivalent of php's parse_url. Currently, I wrote my a simple parser with regex; however, I would think that such function already exists in the in Javascript.
I was wondering if there was a way of adding javascript in every occurrence of a certain HTML tag, eg.
<td onmousedown="">
At the moment I just have it in every single one of my td tags in my table, but there must be a cleaner way. Something like adding javascript in the way CSS adds formatting.
Is there a way to get a variable name as a string in Javascript? (like NSStringFromSelector in Cocoa)
I would like to do like this:
var myFirstName = 'John';
alert(variablesName(myFirstName) + ":" + myFirstName);
--> myFirstName:John
-- added
I'm trying to connect a browser and another program using JavaScript. I would like to send instance names from a browser to another program for callback method.
I want to parse a html-page that unfortunately requires JavaScript to show any content. In order to do so I use a small python-script that pulls the html-code of the page, but after that I have to execute the JavaScript in a DOM-context which seems pretty hard.
To make it even harder I want to use it in a server environment that has no X11-server.
Note: I already read about http://code.google.com/p/pywebkitgtk/ but it seems to need a X-server.
I have a JavaScript function that loads a flash movie into a webpage div using swfobject.embedSWF().
I want to be able to, alternatively, load a .mov file into the same div, in the event that this is the file found instead of the .swf.
Is there a close equivalent to swfobject.embedSWF for the purposes of embedding a .mov file? If not, what is an efficient route to doing this using JavaScript?
I am creating one admin page where I have multiple textboxes.when I enter the userid in one textbox I want to display user name in next textbox when admin moves to next text box.for this I can use ajax or javascript? which one will be better?how can I do it through javascript.
I want to use Google Chart API using javascript. (I don't want to use the python wrapper)
So how do I send data from my python code into the javascript to create graphs?
Hi
I am am running some selenium tests(ruby) on my web page and as i enter an invalid characters in to a text box i have the JavaScript throw a alert like so
if(isNaN($(this).val()) || Number($(this).val().valueOf() <=0)){
alert("Please Enter A Number");
}
how can i handle this alert when its made and close the pop up?
i tried to use the wait_for_pop_up() and close() but i think that's only for browser pop up's and not JavaScript alerts.
any ideas?
thanks
I was hoping to make a website that displays a google map with points based of information returned by a C++ function. I know you can use Java Server Pages to call java methods on the server with javascript. Would there be a way to connect C++ code on the server with javascript in order to produce the same result as java server pages?
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>");
Hi I'm passing a unixtimestamp to a javascript IF statement, can anyone tell me how to generate a unixtimestamp one minute in the future with javascript.
Anyhelp would be helpful.
Thanks
Hi,
How can I evaluate's document.write javascript to plaintext in C#? I'm trying to evaluate this:
<script type="text/javascript">
a=2;b=3;
document.write(a+"_"+y);
</script>
to this:
2_3
I am currently implementing a graph visualisation tool using lift on the server side and d3 ( a javascript visualisation framework) for all the visualisation. The problem I have is that in the script I want to get session dependent data from the server.
So basically, my objective is to write lift-valid ajax callbacks in a static js script.
Here is what I tried so far:
What I have tried so far
If you feel that the best solution is one that I already tried feel free to post a detailed answer telling me how to use it exactly and how it completely solves my problem.
REST interface
Usually what one would do to get data from a javascript function in lift is to create a REST interface. However this interface will not be linked to any session. This is the solution I got from my previous question: Get json data in d3 from lift snippet
Give function as argument of script
Another solution would be to give the ajaxcallback as an argument of the main script called to generate my graph. However I expect to have a lot of callbacks and I don't want to have to mess with the arguments of my script.
Write the ajax callback in another script using lift and call it from the main script
This solution, which is similar to a hidden text input is probably the more likely to work. However it is not elegant and it would mean that I would have to load a lot of scripts on load, which is not really conveniant.
Write the whole script in lift and then serve it to the client
This solution can be elegant, however my script is very long and I would really prefer that it remainss static.
What I want
On client side
While reviewing the source code of my webpage I found that the callback for an ajaxSelect is:
<select onchange="liftAjax.lift_ajaxHandler('F966066257023LYKF4=' + encodeURIComponent(this.value), null, null, null)" name="F96606625703QXTSWU" id="node_delete" class="input">
Moreover, there is a variable containing the state of the page in the end of the webpage:
var lift_page = "F96606625700QRXLDO";
So, I am wondering if it is possible to simulate that my ajaxcall is valid using this liftAjax.lift_ajaxHandler function. However I don't know the exact synthax to use.
On server side
Since I "forged" a request on client side, I would now like to get the request on client side and to dispatch it to the correct function. This is where the LiftRules.dispatch object seems the best solution: when it is called, all the session management has been made (the request is authentified and linked to a session), however I don't know how to write the correct piece of code in the append function.
Remark
In lift all names of variables are changed to a random string in order to increase the security, I would like to have the same behavior in my application even if that will probably mean that I will have to "give" the javascript these values. However an array of 15 string values is still a better tradeoff than 15 functions as argument of a javascript function.
I have a text box called txtName on my form.
In my page I know I need to place the code in my HEAD tag like so......
<script type='text/javascript' language="javascript">
document.forms['FormName'].elements['txtName'].value = "Robert"
</script>
But I cant seem to set a value inside my text box.
Hi all,i want to enable facebox jquery using javascript.
here in normal html
<a href="stairs.jpg" rel="facebox">text</a>
how do in javascript ?something like this?
document.location.href="stairs.jpg";
document.location.rel="facebox";
I'm trying to write a code that can run on Android 1.5 and 2.0.1, but I have issues with the javascript engine used on Android 1.5.
alert(localStorage); just hang on v1.5 while on v2.0.1 it alerts correctly.
is there an unblocking way to do it or to detect the version of Android with javascript?
I have a JavaScript variable which holds an HTML page and due to the setup I need to extract everything between <div id="LiveArea"> and </div> from that variable using JavaScript.
Any help is greatly appreciated.
I've just recently started programming, I was hoping for some help.
I have a drop down menu that was originally activated by click_event, however I want to now implement hoverIntent in order to make the menu drop.
The issue I am having now is being able to use the menu, because whenever I invoke the menu now, once I leave the area that activates the menu, the menu closes. If you could explain to me like I'm five, I'd appreciate it, thanks :)
The code I am using as follows:
JavaScript:
function setupUserConfigMenu() {
$('.user_profile_btn').hoverIntent(
function (event) {
$('#user_settings_dropdown').animate({height:['toggle', 'swing']
}, 225);
},
function (event) {
$('#user_settings_dropdown').animate({height:['toggle', 'swing']
}, 225);
})
}
HTML:
<li>
<a href="<%= "#" %>" class="user_profile_btn" title="Your profile page"><%= truncate(current_user.full_name || current_user.name, :length => 28) %>
<div class="arrow_down"></div></a>
<ul id="user_settings_dropdown">
<li>
<a href="<%= current_user.get_url(true) %>">
<%= image_tag current_user.get_thumb_url, :size => "30x30" %>
<div>
<%= truncate(current_user.full_name || current_user.name, :length => 40) %>
<br>
View profile
</div>
</a>
</li>
<div class="grey_line"></div>
<li class="settings_list_item">
<%= link_to "Settings", edit_user_registration_path %>
</li>
<li class="settings_list_item">
<%= link_to "About", "/about" %>
</li>
<li class="settings_list_item">
<%= link_to "Logout", destroy_user_session_path, :method => :delete %>
</li>
</ul>
</li>