Looking to run through something very similar to (http://www.emcro.com/blog/2009/01/facebook-infinite-session-keys-no-more/) but using javascript instead. Any ideas on how to accomplish this?
Clicking on the image should show div near it (.show() in jQuery).
But how can i attach div to that image? Is it done with pure css, or javascript?
I tried several "position:absolute", but can't attach it near image.
How it should be done?
I think I have not got the syntax correct for writing a javascript function and calling it to assign its return value to a variable.
My function is:
getObjName(objId){
var objName ="";
$.ajax( {
type : "GET",
url : "Object",
dataType: 'json',
data : "objId="+objId,
success : function(data) {
objName = data;
}
});
return objName;
}
I am trying to call it and assign it to a variable with:
var objName = getObjName(objId);
However Eclipse is telling me that "there is no such function getObjName() defined"
Hi ,
i have few numbers like
0011,0101,0123,1234,5245,0052,3265,0047,0124
How replace prefix zero only,
like no number should start with zero ,
exactly like
0011 should be 11 ,
0101 should be 101 ,
0123 should be 123
How to do this ?
Is ther any javascript function there ,
Thanks
CODES:
$().ready(function(){
function sample()
{
alert("This is sample function");
}
$("#button").click(function(){
t=setTimeout("sample()",2000);
});
});
HTML:
<input type="button" name="button" id="button" value="Call sample function with delay">
Once i click button sample function is not called with a delay of 2 seconds. I dont know whats wrong. Please notify me how to do this
Question: To call javascript function using setTimeout via jquery
Hi,
I am trying to format this line of code in my popup window, but i am facing unterminated string literal error.
Can somebody please tell me how best I could format this.
window.setTimeout("winId.document.write('<script src="../js/tiny_mce/tiny_mce.js" type="text/javascript"></script>\n')", 10);
Also point out if this particular line of code would work fine in the popup?
Hi,
May I know the reason of getting the output of the following code as: 1,10,10? Why not it is as: 10, 10?
<script type="text/javascript">
var str="1, 100 or 1000?";
var patt1=/10?/g;
document.write(str.match(patt1));
</script>
HI ,
i am having a table like
<table id="toc" class="toc" border="1" summary="Contents">
</table>
i am trying to delete the entire table using javascript.how to do this??
Whats the easiest way in javascript to replace ABC, DEF, GHI with XYZ in the following strings
http://z.site.com/z/ABC/z/z.html
http://z.site.com/z/DEF/z/z.html
http://z.site.com/z/GHI/z/z.html
It seems that javascript only can ready inline css if i want to check if element is display:hidden getting it with:
el.style.display
But how to check if display:none is placed inside external CSS file?
is it possible to call a dynamic method in javascript. ie suppose i have in my page 2 methods as such:
function id1_add()
{
return 1;
}
function id2_add()
{
return 2;
}
i also have this function:
function add()
{
var s1='id1';
s1+'_add()'; //???
}
is it possible to call for example id1_add() in such:
s1+'_add()';
so the method call depends on a previous string?
Hi everyone!
Is it possible to call a ruby method inside javascript? One way of implementing it is via ajax calls, but is there a way I can embed that ruby function inside the js file and call it just like calling any other js function?
Is there any javascript(/jquery) framework/plugin which generates Balloons? The one that can be used in Comics. The balloon dynamically expands and contracts based on the length of the quote.
I have a small JavaScript validation script that validates inputs based on Regex. I want to allow certain characters that are not exactly common (not sure if they're UTF8). For example I want to allow the following character ’, which looks like a single quote, but isn't.
I got the HTML code for this which is ’, but I'm not sure how to put this into the Regex.
I've tried just inputting [’]* but it doesn't validate.
Dear All,
I am experienced in the technical support like Linux, oracle, sunos etc and but if i say scripting i know little bit of bash. Now i promoted to manage technical engineers including some JavaScript developers, so i want to learn JavaScripting so that i can understand engineers. Hope you understand. Can you please advise me how can i start JavaScripting and point me to some simple docs and examples.
Please help about controlling PDFs through JavaScript loaded inside Safari.
Safari uses a PDF plugin of its own something exclusive to Safari and not present in other webkit based browsers like Chrome.
Any of the or js commands that would work with the Adobe's plugin don't seem to work.
Any help / pointers would be appreciated.
I want to create a PDF file based on users' query result (in html table).
What is the best javascript/lib I can use for IE?
I found jsPDF but it does not support IE.
I am taking a text file from user and then posting that file back to the browser using ajax storing the content in db and then showing the content back to user page using Jquery post response.
Now i want to something like this..
Read the text file from the user computer using javascript. Display the content and when he submits the page I will save the values.
hey..
i'm working on my html and javascript project and i wanted to add music for the website..
i was wondering is there anyway i can put more than one song in the code to be played, if there is please write the code
and is there anyway that the song will continue when openning the next page??
please help
thanks alot
How is it possible to make a input field editable in javascript. I mean onFocus putting it in insert mode so that values can be overwritten. Any suggestions ???
Hi everybody, I'm trying to develop a personal website and running into some issues. At the top of my page I had a horizontal table that contained 6 different images (buttons) that linked to different sections of the page.
I wanted to spice up the buttons with JavaScript and make the image of the button change onMouseOver and onMouseOut so I found a way to do so online with some JavaScript but the problem now is that the buttons no longer jump to the appropriate section of the page when using Google Chrome or Safari, but in IE 9 they still do work correctly...
Here is my old code that worked properly:
<html>
...
<body>
<center>
<table border="1" style="color:#D80000;text-align:center">
<tr>
<td>
<a href="#about"><img src="images/aboutMe.png" alt="About Me"></a>
</td>
<td>
<a href="#courses"><img src="images/courseList.png" alt="Courses"></a>
</td>
<td>
<a href="#work"><img src="images/workHistory.png" alt="Work History"></a>
</td>
<td>
<a href="#places"><img src="images/placesBeen.png" alt="Places I've Been"></a>
</td>
<td>
<a href="#games"><img src="images/gamesPlay.png" alt="Games I Play"></a>
</td>
<td>
<a href="#contact"><img src="images/contactMe.png" alt="Contact"></a>
</td>
</tr>
</table>
</center>
...
</body>
</html>
Here is my new code that is now broken:
<html>
<head>
...
<script type="text/javascript">
<!--
if (document.images)
{
<!-- Preload original Images -->
var about_init= new Image();
about_init.src="images/aboutMe.png";
var courses_init= new Image();
courses_init.src="images/courseList.png";
var work_init= new Image();
work_init.src="images/workHistory.png";
var places_init= new Image();
places_init.src="images/placesBeen.png";
var games_init= new Image();
games_init.src="images/gamesPlay.png";
var contact_init= new Image();
contact_init.src="images/contactMe.png";
<!--Preload images for mouseover -->
var about_new= new Image();
about_new.src="images/aboutAlt.png";
var courses_new= new Image();
courses_new.src="images/courseAlt.png";
var work_new= new Image();
work_new.src="images/workAlt.png";
var places_new= new Image();
places_new.src="images/placesAlt.png";
var games_new= new Image();
games_new.src="images/gamesAlt.png";
var contact_new= new Image();
contact_new.src="images/contactAlt.png";
}
function change_it(the_name)
{
if (document.images)
{
document.images[the_name].src= eval(the_name+"_new.src");
}
}
function change_back(the_name)
{
if (document.images)
{
document.images[the_name].src= eval(the_name+"_init.src");
}
}
//-->
</script>
</head>
<body>
...
<center>
<table border="1" style="color:#D80000;text-align:center">
<tr>
<td>
<a href="#about" onMouseOver="change_it('about')" onMouseOut="change_back('about')"><img src="images/aboutMe.png" name="about" id="about" border="0" alt="About Me"></a>
</td>
<td>
<a href="#courses" onMouseOver="change_it('courses')" onMouseOut="change_back('courses')"><img src="images/courseList.png" name="courses" id="courses" border="0" alt="Courses"></a>
</td>
<td>
<a href="#work" onMouseOver="change_it('work')" onMouseOut="change_back('work')"><img src="images/workHistory.png" name="work" id="work" border="0" alt="Work History"></a>
</td>
<td>
<a href="#places" onMouseOver="change_it('places')" onMouseOut="change_back('places')"><img src="images/placesBeen.png" name="places" id="places" border="0" alt="Places I've Been"></a>
</td>
<td>
<a href="#games" onMouseOver="change_it('games')" onMouseOut="change_back('games')"><img src="images/gamesPlay.png" name="games" id="games" border="0" alt="Games I Play"></a>
</td>
<td>
<a href="#contact" onMouseOver="change_it('contact')" onMouseOut="change_back('contact')"><img src="images/contactMe.png" name="contact" id="contact" border="0" alt="Contact"></a>
</td>
</tr>
</table>
</center>
...
</body>
</html>
The images properly switch when the mouse is moved over/off them, but the jump to the corresponding page sections seems to be broken, it seems like they're all jumping to the #about section now. Once again, the weirder thing is that this is only the case when I'm using Google Chrome on my laptop running Windows 7 or Safari using my iPhone 4 but when I use the new Internet Explorer 9 on my laptop running Windows 7 all the buttons still link correctly.
Any idea what's breaking the links?
For a JavaScript project we want to introduce object inheritance to decrease code duplication. However, I cannot quite get it working the way I want and need some help.
We use the module pattern. Suppose there is a super element:
a.namespace('a.elements.Element');
a.elements.Element = (function() {
// public API -- constructor
Element = function(properties) {
this.id = properties.id;
};
// public API -- prototype
Element.prototype = {
getID: function() {
return this.id;
}
};
return Element;
}());
And an element inheriting from this super element:
a.namespace('a.elements.SubElement');
a.elements.SubElement = (function() {
// public API -- constructor
SubElement = function(properties) {
// inheritance happens here
// ???
this.color = properties.color;
this.bogus = this.id + 1;
};
// public API -- prototype
SubElement.prototype = {
getColor: function() {
return this.color;
}
};
return SubElement;
}());
You will notice that I'm not quite sure how to implement the inheritance itself. In the constructor I have to be able to pass the parameter to the super object constructor and create a super element that is then used to create the inherited one. I need a (comfortable) possibility to access the properties of the super object within the constructor of the new object. Ideally I could operate on the super object as if it was part of the new object.
I also want to be able to create a new SubElement and call getID() on it.
What I want to accomplish seems like the traditional class based inheritance. However, I'd like to do it using prototypal inheritance since that's the JavaScript way. Is that even doable?
Thanks in advance!
EDIT: Fixed usage of private variables as suggested in the comments.
EDIT2: Another change of the code: It's important that id is accessible from the constructor of SubElement.
I am creating quite a bit of XML with JavaScript which is then processed by variuos components. I would like to send this XML to some file and prompt the user to save it on their disk (all this happens in the browser at the client, no server interaction whatsoever). Is this at all possible? Google is not a lot of help here :(
javascript:
location.href("somefile.php"); // successfully working with IE
location.href = "somefile.php";
Ques 1. first code is not work with Safari. Why?
Ques 2. What is the difference b/w these codes.
Thanks,