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
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?
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!
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?
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.
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?
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!
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?
Hi,
I want to disable writing in an input type text using javascript
the input type text is populated from database that is why i don't want that user modify its value.
Thinks for help
Is there a built in equivalent to the .NET framework's DateAdd or AddMonths functions?
I'm looking for the easiest, cleanest way to add X month to a Javascript date.
I'd rather not handle the rolloing over of the year as done here.
or have to write my own function as done here.
Is there something built in that is as nice as the .NET Date.AddMonths function? Or something close?
I want to display a certain message on a certain page.
Suppose the name of the page I want to display something on is called "foo_page.html",
How can I do this using javascript?
is there a way to load the full binary of an image in javascript?
what i want to do is to allow the user to preview an image before uploading it.
ie the user selects an image on his local drive (C:\image.jpg) , view it, and decides to upload or cancel.
i tried to set the source to the image path, but it didn't work since it is outside the webapplication project folder.
any help?
How to convert such an array from PHP to JavaScript?:
$arr = array('oneKey' => array('key1' => 'value1',
'key2' => 'value2'),
'anotherKey => array('key1 => 'value1',
'key2 => 'value2'));
I have a text:
<font class="myclass">class abc</font>
and i have a pattern: class
now, i want to find the word "class" before "abc" but not in the <font class="myclass"> ,how could i do with RegExp in javascript?
Thanks! :)
instead of using getParameterByName('Field', PostData) (PostData == $('form').serialize();)
I would like to write PostData.Field, how can i do that with javascript?
Hi all,
Looking for a creative way to be sure values that come from the getHours, getMinutes, and getSeconds() method for the javascript Date object return "06" instead of 6 (for example). Are there any parameters that I don't know about? Obviously I could write a function that does it by checking the length and prepending a "0" if need be, but I thought there might be something more streamlined than that.
Thanks.
I'd like to know the x/y offset of the how far the user has "scrolled" within the viewport in mobile safari on the iphone.
Put another way, if I (through javascript) reloaded the current page, I'd like to find the values I'd need to pass into window.scrollTo(...) in order to reposition the document/viewport as it is currently.
window.pageXOffset always reports 0
jquery's $('body').scrollTop() always reports 0
events have a pageX, but this won't account for the scrolling of the page that happens after you release your finger if your gesture was to "flick" the page up/down. Namely, it'll give me a point when the finger leaves the screen, but that doesn't always match where the page will be after it's finished scrolling.
Any pointers?
I have a select list which has a function with a jQuery .post bound on the change() event.
<select id="location">
<option value="1"></option>
<option value="2"></option>
</select>
$('#location').change(location_change);
function location_change(){
var url = '';
$.post(url, callback);
}
What I would like to happen is other controls on the page can bind to the $.post callback function like it was an event, so after the location is changed the data is posted back to the server and once the post returns successfully, the subscriber events are fired.