i like to split a string depending on "," character using JavaScript
example
var mystring="1=name1,2=name2,3=name3";
need output like this
1=name1
2=name2
3=name3
I have tried javascript window.print() It prints the full page content including the print button on the page.
thanks in advance for any solution and help
I need to get some children elements and loop over them using inline javascript for a onmouseover event. When I try to use this.getElementsByName I'm getting an error that the object does not support this property. I was under the impression that getElementsByName work for element objects which I thought 'this' would be considered. Anyone have any other ideas on how I can achieve this?
Hi,
I have a javascript function that writes the value of input box to a cookie, then it tells the page to refresh. The page must be refreshed to the server side can reconstruct the page based on the values of the cookies. Output the correct data on the page.
However I do not want the user to lose the value they type on the input box unless they erase it.
what can i do?
I was wondering why the Vector variable defined within this self executing javascript function doesn't require a var before it? Is this just some other type of syntax for creating a named function? Does this make it so we can't pass Vector as an argument to other functions?
(function() {
Vector = function(x, y) {
this.x = x;
this.y = y;
return this;
};
//...snip
})()
I have been getting some weird page refresh in deployment and I can't seem to find the cause of it or replicate it in development. Is there a way for a javascript error or exception to cause a page reload? Or some tips to help me narrow down the cause?
Basically I want the books to be text book based, ie, author discusses the background,philosophy,syntax,semtantix for every language AND after every section there are questions what you learned so far and mini projects. Is there any books like this, I'm absolutely new to php/mysql/javascript and web development in general. Thanks in advance.
Hi
Which is best book to learn HTML, CSS, Javascript, ASP.NET 3.5 & Ajax? I would like to have a single book covering all the above topics.
Thanks
Satyaprakash
Guys I have a couple of questions:
Is there a preformance difference in Javascript between a switch statement and an if...else if....else?
If so why?
Is the behavior of switch and if...else if...else different across browsers? (FireFox, IE, Chrome, Opera, Safari)
Is there any "python's Generator" equivalent in JavaScript?
PS:
Python's Generator is very memory efficient when we need to do one time iterate through a big array, hash...
"Generators are iterables, but you can only read them once. It's because they do not store all the values in memory, they generate the values on the fly"
(Python's Generator explained in this thread: The Python yield keyword explained )
I've seen this all over the web
javascript:__doPostBack('ctl00$ContentPlaceHolder1$lnk2','')
Checking headers of the last place I saw it didn't reveal a server side language.
What server side language and/or framework encourages this style of link?
Is there a way to use javascript to determine how long someone was looking at my webpage before they closed their browser or hit the back button? Something like send a message to php page every few seconds or so in the background?
if anyone fancies doing me a really quick favour, it would be really appreciated:
static function make_url_safe($z){
$z = strtolower($z);
$z = preg_replace('/[^a-zA-Z0-9\s] /i', '', $z);
$z = str_ireplace(' ', '-', $z);
return $z;
}
what js functions should i be looking at to convert this function to javascript?
There is something in my mind:
In a web page,there are lots of things we can see from our browser.One of them is text.
Now i have some patterns,"abc","hello",or some other strings.In the text, i want to find all the patterns and change the color or background-color of them.
Like this:
text: what a wonderful day! pattern: "a","day"
resulet: what a wonderful day!
How can solve this whit Javascript?
What would be the preferred way to convert opacity (0 - 1) to hex (00 - ff) in Javascript?
My thoughts are to use an if statement to check if opacity is between 1 and 0.95 then use ff. Work my way down to 0.
Hi all
I wanted to ask if there is a formal way of describing the following code, whereby we can access the same object repeatedly without re-typing the object's identifier:
myObj.render(1).render(2).print();
I didn't know how to describe it when trying to form a question; I wanted to know whether or not something like this is possible in javascript, I know that I can do it in VB:
myObj.render(1)
if(foo == 'bar')
.render(2)
.print();
Thanks!
Can someone help me fill in the blanks with native JavaScript?
function getHeading(lat1, lon1, lat2, lon2) {
// Do cool things with math here
return heading; // Should be a number between 0 and 360
}
I've been messing around with this for a long time and can't seem to get my code to work right.
The question says it all really, I'm looking for book recommendations, video tutorials etc. I've been programming since I was about six so I don't need a book that spends 4 pages on for loops (thought that might be a Bad example in terms of javascript).
Also I'm learning ASP.net at the moment so anything on interoperability features/issues would be welcome, though I'm guessing I just showed my ignorance with that question.
Hello, could some one recommend a way to get page name from a url using JavaScript?
For instance if I have http://www.cnn.com/news/1234/news.html?a=1&b=2&c=3
I just need to get "news.html" string
Thanks!
Hi,
In javascript, how can I test 2 "sets" of conditions in one if statement? example:
if ((a == 'someValue' && b == 'someValue') || (c == 'someValue' && d == 'someValue')) {
// do something
}
Thanks!